From 5d50a92a6f7d6d3508c06a6cd8de46451efd7806 Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Thu, 6 Apr 2023 08:45:36 -0700 Subject: [PATCH 01/95] Rebuild for tesseract again after ngompa's change --- ffmpeg.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ffmpeg.spec b/ffmpeg.spec index 3b16bfd..ea55ffb 100644 --- a/ffmpeg.spec +++ b/ffmpeg.spec @@ -92,7 +92,7 @@ Name: ffmpeg %global pkg_name %{name}%{?pkg_suffix} Version: 6.0 -Release: 4%{?dist} +Release: 5%{?dist} Summary: A complete solution to record, convert and stream audio and video License: GPL-3.0-or-later URL: https://ffmpeg.org/ @@ -854,6 +854,9 @@ rm -rf %{buildroot}%{_datadir}/%{name}/examples %{_mandir}/man3/libswscale.3* %changelog +* Thu Apr 06 2023 Adam Williamson - 6.0-5 +- Rebuild (tesseract) again + * Mon Apr 03 2023 Neal Gompa - 6.0-4 - Include RISC-V support sources in the tarball From 92fb6f48969332dbaa15e86adea36cc692dfe1af Mon Sep 17 00:00:00 2001 From: Dominik Mierzejewski Date: Mon, 12 Jun 2023 08:45:18 +0200 Subject: [PATCH 02/95] Rebuild for libdc1394 --- ffmpeg.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ffmpeg.spec b/ffmpeg.spec index ea55ffb..446415a 100644 --- a/ffmpeg.spec +++ b/ffmpeg.spec @@ -92,7 +92,7 @@ Name: ffmpeg %global pkg_name %{name}%{?pkg_suffix} Version: 6.0 -Release: 5%{?dist} +Release: 6%{?dist} Summary: A complete solution to record, convert and stream audio and video License: GPL-3.0-or-later URL: https://ffmpeg.org/ @@ -854,6 +854,9 @@ rm -rf %{buildroot}%{_datadir}/%{name}/examples %{_mandir}/man3/libswscale.3* %changelog +* Mon Jun 12 2023 Dominik Mierzejewski - 6.0-6 +- Rebuild for libdc1394 + * Thu Apr 06 2023 Adam Williamson - 6.0-5 - Rebuild (tesseract) again From c5e3c6b45d15862d5ab4b0beef04661733f3f52d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20M=2E=20Basto?= Date: Sun, 18 Jun 2023 19:21:45 +0100 Subject: [PATCH 03/95] Mass rebuild for jpegxl-0.8.1 --- ffmpeg.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ffmpeg.spec b/ffmpeg.spec index 446415a..f505b4b 100644 --- a/ffmpeg.spec +++ b/ffmpeg.spec @@ -92,7 +92,7 @@ Name: ffmpeg %global pkg_name %{name}%{?pkg_suffix} Version: 6.0 -Release: 6%{?dist} +Release: 7%{?dist} Summary: A complete solution to record, convert and stream audio and video License: GPL-3.0-or-later URL: https://ffmpeg.org/ @@ -854,6 +854,9 @@ rm -rf %{buildroot}%{_datadir}/%{name}/examples %{_mandir}/man3/libswscale.3* %changelog +* Sun Jun 18 2023 Sérgio Basto - 6.0-7 +- Mass rebuild for jpegxl-0.8.1 + * Mon Jun 12 2023 Dominik Mierzejewski - 6.0-6 - Rebuild for libdc1394 From 897126763db9746102f6bf53daed86dc6c854c74 Mon Sep 17 00:00:00 2001 From: Sandro Mani Date: Fri, 14 Jul 2023 12:45:53 +0200 Subject: [PATCH 04/95] Rebuild (tesseract) --- ffmpeg.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ffmpeg.spec b/ffmpeg.spec index f505b4b..067bdb2 100644 --- a/ffmpeg.spec +++ b/ffmpeg.spec @@ -92,7 +92,7 @@ Name: ffmpeg %global pkg_name %{name}%{?pkg_suffix} Version: 6.0 -Release: 7%{?dist} +Release: 8%{?dist} Summary: A complete solution to record, convert and stream audio and video License: GPL-3.0-or-later URL: https://ffmpeg.org/ @@ -854,6 +854,9 @@ rm -rf %{buildroot}%{_datadir}/%{name}/examples %{_mandir}/man3/libswscale.3* %changelog +* Fri Jul 14 2023 Sandro Mani - 6.0-8 +- Rebuild (tesseract) + * Sun Jun 18 2023 Sérgio Basto - 6.0-7 - Mass rebuild for jpegxl-0.8.1 From d0a510651ebba3f5dde773ada6557273c40a0c01 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Wed, 19 Jul 2023 19:38:25 +0000 Subject: [PATCH 05/95] Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- ffmpeg.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ffmpeg.spec b/ffmpeg.spec index 067bdb2..40d419c 100644 --- a/ffmpeg.spec +++ b/ffmpeg.spec @@ -92,7 +92,7 @@ Name: ffmpeg %global pkg_name %{name}%{?pkg_suffix} Version: 6.0 -Release: 8%{?dist} +Release: 9%{?dist} Summary: A complete solution to record, convert and stream audio and video License: GPL-3.0-or-later URL: https://ffmpeg.org/ @@ -854,6 +854,9 @@ rm -rf %{buildroot}%{_datadir}/%{name}/examples %{_mandir}/man3/libswscale.3* %changelog +* Wed Jul 19 2023 Fedora Release Engineering - 6.0-9 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild + * Fri Jul 14 2023 Sandro Mani - 6.0-8 - Rebuild (tesseract) From a8da7eeb175bea0f22c7b4c5ca89fe3fa646aa86 Mon Sep 17 00:00:00 2001 From: Dominik Mierzejewski Date: Fri, 28 Jul 2023 10:49:56 +0200 Subject: [PATCH 06/95] Rebuild for libplacebo --- ffmpeg.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ffmpeg.spec b/ffmpeg.spec index 40d419c..42a208c 100644 --- a/ffmpeg.spec +++ b/ffmpeg.spec @@ -92,7 +92,7 @@ Name: ffmpeg %global pkg_name %{name}%{?pkg_suffix} Version: 6.0 -Release: 9%{?dist} +Release: 10%{?dist} Summary: A complete solution to record, convert and stream audio and video License: GPL-3.0-or-later URL: https://ffmpeg.org/ @@ -854,6 +854,9 @@ rm -rf %{buildroot}%{_datadir}/%{name}/examples %{_mandir}/man3/libswscale.3* %changelog +* Fri Jul 28 2023 Dominik Mierzejewski - 6.0-10 +- Rebuild for libplacebo + * Wed Jul 19 2023 Fedora Release Engineering - 6.0-9 - Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild From 717e5ed3772ca3295990f04bfaeef89cf08cbfdc Mon Sep 17 00:00:00 2001 From: Richard Shaw Date: Sat, 5 Aug 2023 15:51:42 -0500 Subject: [PATCH 07/95] Rebuild for codec2. --- ffmpeg.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ffmpeg.spec b/ffmpeg.spec index 42a208c..bee14b9 100644 --- a/ffmpeg.spec +++ b/ffmpeg.spec @@ -92,7 +92,7 @@ Name: ffmpeg %global pkg_name %{name}%{?pkg_suffix} Version: 6.0 -Release: 10%{?dist} +Release: 11%{?dist} Summary: A complete solution to record, convert and stream audio and video License: GPL-3.0-or-later URL: https://ffmpeg.org/ @@ -854,6 +854,9 @@ rm -rf %{buildroot}%{_datadir}/%{name}/examples %{_mandir}/man3/libswscale.3* %changelog +* Sat Aug 05 2023 Richard Shaw - 6.0-11 +- Rebuild for codec2. + * Fri Jul 28 2023 Dominik Mierzejewski - 6.0-10 - Rebuild for libplacebo From 9bc65b1ebf39968fb6abfb899f3d7cf739b2ef48 Mon Sep 17 00:00:00 2001 From: Dominik 'Rathann' Mierzejewski Date: Fri, 25 Aug 2023 15:08:21 +0200 Subject: [PATCH 08/95] Backport upstream patch to fix assembly with binutils 2.41. --- ...ops-clip-constants-used-with-shift-i.patch | 76 +++++++++++++++++++ ffmpeg.spec | 8 +- 2 files changed, 83 insertions(+), 1 deletion(-) create mode 100644 0001-avcodec-x86-mathops-clip-constants-used-with-shift-i.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 new file mode 100644 index 0000000..f47e827 --- /dev/null +++ b/0001-avcodec-x86-mathops-clip-constants-used-with-shift-i.patch @@ -0,0 +1,76 @@ +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.spec b/ffmpeg.spec index bee14b9..db1921f 100644 --- a/ffmpeg.spec +++ b/ffmpeg.spec @@ -92,7 +92,7 @@ Name: ffmpeg %global pkg_name %{name}%{?pkg_suffix} Version: 6.0 -Release: 11%{?dist} +Release: 12%{?dist} Summary: A complete solution to record, convert and stream audio and video License: GPL-3.0-or-later URL: https://ffmpeg.org/ @@ -122,6 +122,9 @@ 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 + # Set up dlopen for openh264 Patch1001: ffmpeg-dlopen-openh264.patch @@ -854,6 +857,9 @@ rm -rf %{buildroot}%{_datadir}/%{name}/examples %{_mandir}/man3/libswscale.3* %changelog +* Fri Aug 25 2023 Dominik Mierzejewski - 6.0-12 +- Backport upstream patch to fix assembly with binutils 2.41. + * Sat Aug 05 2023 Richard Shaw - 6.0-11 - Rebuild for codec2. From 60f694e267612d2101937e988ffb8065b8ea17d3 Mon Sep 17 00:00:00 2001 From: Nicolas Chauvet Date: Fri, 29 Sep 2023 15:18:11 +0200 Subject: [PATCH 09/95] Rebuilt --- ffmpeg.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ffmpeg.spec b/ffmpeg.spec index db1921f..22c7c0a 100644 --- a/ffmpeg.spec +++ b/ffmpeg.spec @@ -92,7 +92,7 @@ Name: ffmpeg %global pkg_name %{name}%{?pkg_suffix} Version: 6.0 -Release: 12%{?dist} +Release: 13%{?dist} Summary: A complete solution to record, convert and stream audio and video License: GPL-3.0-or-later URL: https://ffmpeg.org/ @@ -857,6 +857,9 @@ rm -rf %{buildroot}%{_datadir}/%{name}/examples %{_mandir}/man3/libswscale.3* %changelog +* Fri Sep 29 2023 Nicolas Chauvet - 6.0-13 +- Rebuilt for libplacebo + * Fri Aug 25 2023 Dominik Mierzejewski - 6.0-12 - Backport upstream patch to fix assembly with binutils 2.41. From 0bad397a421d90a718251b2accd388952226c4aa Mon Sep 17 00:00:00 2001 From: Neal Gompa Date: Sat, 30 Sep 2023 08:09:48 -0400 Subject: [PATCH 10/95] Fix ffmpeg-allow-fdk-aac-free.patch to apply with git-am --- ffmpeg-allow-fdk-aac-free.patch | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ffmpeg-allow-fdk-aac-free.patch b/ffmpeg-allow-fdk-aac-free.patch index 0cc91f1..3b87cce 100644 --- a/ffmpeg-allow-fdk-aac-free.patch +++ b/ffmpeg-allow-fdk-aac-free.patch @@ -1,3 +1,5 @@ +From: Andreas Schneider + fdk-aac-free-devel is GPL compatible See https://bugzilla.redhat.com/show_bug.cgi?id=1501522#c112 From 8be4d0455dfdac5698c97a6d8cdadf7fc5e716f0 Mon Sep 17 00:00:00 2001 From: Sandro Mani Date: Sat, 7 Oct 2023 23:53:30 +0200 Subject: [PATCH 11/95] Rebuild (tesseract) --- ffmpeg.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ffmpeg.spec b/ffmpeg.spec index 22c7c0a..f8c7684 100644 --- a/ffmpeg.spec +++ b/ffmpeg.spec @@ -92,7 +92,7 @@ Name: ffmpeg %global pkg_name %{name}%{?pkg_suffix} Version: 6.0 -Release: 13%{?dist} +Release: 14%{?dist} Summary: A complete solution to record, convert and stream audio and video License: GPL-3.0-or-later URL: https://ffmpeg.org/ @@ -857,6 +857,9 @@ rm -rf %{buildroot}%{_datadir}/%{name}/examples %{_mandir}/man3/libswscale.3* %changelog +* Sat Oct 07 2023 Sandro Mani - 6.0-14 +- Rebuild (tesseract) + * Fri Sep 29 2023 Nicolas Chauvet - 6.0-13 - Rebuilt for libplacebo From 88ff89db5bbcb87295666f2e4a9e602d8a9c1394 Mon Sep 17 00:00:00 2001 From: Dominik Mierzejewski Date: Mon, 9 Oct 2023 10:04:19 +0200 Subject: [PATCH 12/95] Backport upstream patch to fix segfault when passing non-existent filter option (rfbz#6773) --- ...ilter-initialize-the-o-to-silence-th.patch | 30 +++++++++++++++++++ ffmpeg.spec | 9 +++++- 2 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 0001-fftools-ffmpeg_filter-initialize-the-o-to-silence-th.patch diff --git a/0001-fftools-ffmpeg_filter-initialize-the-o-to-silence-th.patch b/0001-fftools-ffmpeg_filter-initialize-the-o-to-silence-th.patch new file mode 100644 index 0000000..85b43a4 --- /dev/null +++ b/0001-fftools-ffmpeg_filter-initialize-the-o-to-silence-th.patch @@ -0,0 +1,30 @@ +From a0a0a804998da8d1a397479c9bafeb000e6be088 Mon Sep 17 00:00:00 2001 +From: Jun Zhao +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 +--- + 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 + diff --git a/ffmpeg.spec b/ffmpeg.spec index 3b16bfd..9598d2e 100644 --- a/ffmpeg.spec +++ b/ffmpeg.spec @@ -92,7 +92,7 @@ Name: ffmpeg %global pkg_name %{name}%{?pkg_suffix} Version: 6.0 -Release: 4%{?dist} +Release: 5%{?dist} Summary: A complete solution to record, convert and stream audio and video License: GPL-3.0-or-later URL: https://ffmpeg.org/ @@ -121,6 +121,9 @@ 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 # Set up dlopen for openh264 Patch1001: ffmpeg-dlopen-openh264.patch @@ -854,6 +857,10 @@ rm -rf %{buildroot}%{_datadir}/%{name}/examples %{_mandir}/man3/libswscale.3* %changelog +* Sun Oct 08 2023 Dominik Mierzejewski - 6.0-5 +- Backport upstream patch to fix segfault when passing non-existent filter + option (rfbz#6773) + * Mon Apr 03 2023 Neal Gompa - 6.0-4 - Include RISC-V support sources in the tarball From 853aa9d7cf3e80fa9f3ad9ce6a54ba3ba086894d Mon Sep 17 00:00:00 2001 From: Dominik Mierzejewski Date: Mon, 9 Oct 2023 10:09:54 +0200 Subject: [PATCH 13/95] Backport upstream patch to fix segfault when passing non-existent filter option (rfbz#6773) --- ...ilter-initialize-the-o-to-silence-th.patch | 30 +++++++++++++++++++ ffmpeg.spec | 10 ++++++- 2 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 0001-fftools-ffmpeg_filter-initialize-the-o-to-silence-th.patch diff --git a/0001-fftools-ffmpeg_filter-initialize-the-o-to-silence-th.patch b/0001-fftools-ffmpeg_filter-initialize-the-o-to-silence-th.patch new file mode 100644 index 0000000..85b43a4 --- /dev/null +++ b/0001-fftools-ffmpeg_filter-initialize-the-o-to-silence-th.patch @@ -0,0 +1,30 @@ +From a0a0a804998da8d1a397479c9bafeb000e6be088 Mon Sep 17 00:00:00 2001 +From: Jun Zhao +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 +--- + 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 + diff --git a/ffmpeg.spec b/ffmpeg.spec index f8c7684..d68704b 100644 --- a/ffmpeg.spec +++ b/ffmpeg.spec @@ -92,7 +92,7 @@ Name: ffmpeg %global pkg_name %{name}%{?pkg_suffix} Version: 6.0 -Release: 14%{?dist} +Release: 15%{?dist} Summary: A complete solution to record, convert and stream audio and video License: GPL-3.0-or-later URL: https://ffmpeg.org/ @@ -125,6 +125,10 @@ 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 + # Set up dlopen for openh264 Patch1001: ffmpeg-dlopen-openh264.patch @@ -857,6 +861,10 @@ rm -rf %{buildroot}%{_datadir}/%{name}/examples %{_mandir}/man3/libswscale.3* %changelog +* Sun Oct 08 2023 Dominik Mierzejewski - 6.0-15 +- Backport upstream patch to fix segfault when passing non-existent filter + option (rfbz#6773) + * Sat Oct 07 2023 Sandro Mani - 6.0-14 - Rebuild (tesseract) From d30a3b67b3683d62ac44a073e0cc730e4089fb1d Mon Sep 17 00:00:00 2001 From: Neal Gompa Date: Fri, 10 Nov 2023 07:13:31 -0500 Subject: [PATCH 14/95] Add patches to support enhanced RTMP and AV1 encoding through VA-API - Force AAC decoding through fdk-aac-free --- ...l-v10-Support-enhanced-flv-in-FFmpeg.patch | 1230 +++++ enable_decoders | 1 - enable_encoders | 1 + ffmpeg-ge-av1-vaapi-encode-support.patch | 3984 +++++++++++++++++ ffmpeg.spec | 16 +- 5 files changed, 5230 insertions(+), 2 deletions(-) create mode 100644 FFmpeg-devel-v10-Support-enhanced-flv-in-FFmpeg.patch create mode 100644 ffmpeg-ge-av1-vaapi-encode-support.patch diff --git a/FFmpeg-devel-v10-Support-enhanced-flv-in-FFmpeg.patch b/FFmpeg-devel-v10-Support-enhanced-flv-in-FFmpeg.patch new file mode 100644 index 0000000..28ff7bb --- /dev/null +++ b/FFmpeg-devel-v10-Support-enhanced-flv-in-FFmpeg.patch @@ -0,0 +1,1230 @@ +From patchwork Mon May 15 08:31:56 2023 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +X-Patchwork-Submitter: Steven Liu +X-Patchwork-Id: 41615 +Delivered-To: ffmpegpatchwork2@gmail.com +Received: by 2002:a05:6a20:ba91:b0:105:feb:71f2 with SMTP id + fb17csp1443896pzb; + Mon, 15 May 2023 01:33:01 -0700 (PDT) +X-Google-Smtp-Source: + ACHHUZ69PgG6fq/KF6IIeKoVV29fkg7cAJfmPD3LnnTmI9YYVAPo/alZm7B+7f+FoOgn9rHdYUo5 +X-Received: by 2002:a17:907:97cb:b0:96a:4654:9a57 with SMTP id + js11-20020a17090797cb00b0096a46549a57mr16869758ejc.54.1684139580951; + Mon, 15 May 2023 01:33:00 -0700 (PDT) +ARC-Seal: i=1; a=rsa-sha256; t=1684139580; cv=none; + d=google.com; s=arc-20160816; + b=iOREUkvWDLqSJl40trM7wg3ufEQ23FOBLjpslXsds5HWyK48b/76lFgQwRfHJbHqbh + vc4N6DopB5msRi0VK/pJnDAdtuyQR2tqEgLvbZpHJzjK1zHUKRV5JHlmVhNvQOfYWpMR + VL/1OMmbTctEza2Z7/VYsrVLHLy4QOlLh4w/JdRcx/7rhiOA1ixpMxC4qUb5IGMhnqen + P2dDbAoqdmGUZtmA4VOfxkgkHnIaeFv+UffJGIZs1Lyb7c3zytwdpLLiezRzVLWQaStW + TVdcDk45pOrA29lZ46Tq8YNJP7O5zfSevFIqrB85mUjSNoyZi24gz19yxJa/09O1qb+o + thzw== +ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; + s=arc-20160816; + h=sender:errors-to:content-transfer-encoding:cc:reply-to + :list-subscribe:list-help:list-post:list-archive:list-unsubscribe + :list-id:precedence:subject:feedback-id:mime-version:references + :in-reply-to:message-id:date:to:from:delivered-to; + bh=Qg7uugO6uqQCX67+SdNELVYF39/WDPRDFt1+H7toQ+s=; + b=b1cxdqSVG1Oc157HlNUA+LfJhknU/nr3g5wnSLXmP7DrR+RQp2CFwGfjV+wTkfWLok + WydumkYG2biOpmhMi+mG4ci5WvU2R9bv1qpKGreRpsImGmjubQxu5CC9gwmenz3c+1v8 + pu+qkw142w9uMerjOpaw6oWvaHq9hWGVy6Uni33AqMJhfj9WqSwBCezk62krxzBar/VN + XNbzzpAMIuXcj0DcHS70oDHOTbtLq4uDLGpkQwnBpYbswfGD0h8N+B+BSCs3ZqN/l5Jc + juIQY4i3ja2W1yHm6Zlze2qU8lFRPzRwVBZBv9vro88VyFic0UZx9wRuIqJB9BZIb0h/ + vkiA== +ARC-Authentication-Results: i=1; mx.google.com; + spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org + designates 79.124.17.100 as permitted sender) + smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org +Return-Path: +Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) + by mx.google.com with ESMTP id + gt37-20020a1709072da500b0096b1c38458dsi2828116ejc.409.2023.05.15.01.33.00; + Mon, 15 May 2023 01:33:00 -0700 (PDT) +Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org + designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; +Authentication-Results: mx.google.com; + spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org + designates 79.124.17.100 as permitted sender) + smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org +Received: from [127.0.1.1] (localhost [127.0.0.1]) + by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id D930568BE0C; + Mon, 15 May 2023 11:32:57 +0300 (EEST) +X-Original-To: ffmpeg-devel@ffmpeg.org +Delivered-To: ffmpeg-devel@ffmpeg.org +Received: from bg4.exmail.qq.com (bg4.exmail.qq.com [43.155.67.158]) + by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 522F7680274 + for ; Mon, 15 May 2023 11:32:49 +0300 (EEST) +X-QQ-mid: bizesmtp68t1684139564tg642pbl +Received: from localhost ( [103.102.203.204]) by bizesmtp.qq.com (ESMTP) with + id ; Mon, 15 May 2023 16:32:42 +0800 (CST) +X-QQ-SSF: 01100000000000Z0Z000000A0000000 +X-QQ-FEAT: nCMT0YKS3i1MU7IXSsiS1Rwde6i/4Rq2kuPO2PoXw3OvtJB24MU+Y2GwdEg4Y + pg0ZfSggM3VBmRCkHI3ioSOH2mvVyYG9LgwhhyfixPaFItcpF4EF6xoZepQpa1H5v1BDi7s + iwCwF3shgH8dl96iJKKryT4TtjUTnYRoRhCPtLCGfUthaM/R44xdqxRvjDqIVn1BUMb5GPu + DMuaskzO8QQCFxvduUvovkXjJc5v17Krm2lf945Tmm/pIpV/qLjAgAhYHqOoxrgBGHZDYWY + 0XeS7RvYkKTR24z9m9Sk75veOTKtFzksnbLJYkIDYj+voAd1djXPJWtuB2elhm/DIa9+5lW + 2DnKrJ/Bb2Ok13ggXoC600jHcxkLbuOqDuK5k5Dhub7ECOTPJythkMV+FYQCw== +X-QQ-GoodBg: 0 +X-BIZMAIL-ID: 14547348156280638791 +From: Steven Liu +To: ffmpeg-devel@ffmpeg.org +Date: Mon, 15 May 2023 16:31:56 +0800 +Message-Id: <20230515083201.48201-2-lq@chinaffmpeg.org> +X-Mailer: git-send-email 2.40.0 +In-Reply-To: <20230515083201.48201-1-lq@chinaffmpeg.org> +References: + + <20230515083201.48201-1-lq@chinaffmpeg.org> +MIME-Version: 1.0 +X-QQ-SENDSIZE: 520 +Feedback-ID: bizesmtp:chinaffmpeg.org:qybglogicsvrsz:qybglogicsvrsz3a-3 +Subject: [FFmpeg-devel] [PATCH v10 1/6] avformat/flvenc: support mux hevc in + enhanced flv +X-BeenThere: ffmpeg-devel@ffmpeg.org +X-Mailman-Version: 2.1.29 +Precedence: list +List-Id: FFmpeg development discussions and patches +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +Reply-To: FFmpeg development discussions and patches +Cc: Steven Liu +Errors-To: ffmpeg-devel-bounces@ffmpeg.org +Sender: "ffmpeg-devel" +X-TUID: WUhHC4/dXuk+ + +Signed-off-by: Steven Liu +--- + libavformat/Makefile | 2 +- + libavformat/flv.h | 15 +++++++++++++++ + libavformat/flvenc.c | 38 +++++++++++++++++++++++++++++--------- + 3 files changed, 45 insertions(+), 10 deletions(-) + +diff --git a/libavformat/Makefile b/libavformat/Makefile +index f8ad7c6a11..1ef3d15467 100644 +--- a/libavformat/Makefile ++++ b/libavformat/Makefile +@@ -214,7 +214,7 @@ OBJS-$(CONFIG_FLAC_MUXER) += flacenc.o flacenc_header.o \ + OBJS-$(CONFIG_FLIC_DEMUXER) += flic.o + OBJS-$(CONFIG_FLV_DEMUXER) += flvdec.o + OBJS-$(CONFIG_LIVE_FLV_DEMUXER) += flvdec.o +-OBJS-$(CONFIG_FLV_MUXER) += flvenc.o avc.o ++OBJS-$(CONFIG_FLV_MUXER) += flvenc.o avc.o hevc.o + OBJS-$(CONFIG_FOURXM_DEMUXER) += 4xm.o + OBJS-$(CONFIG_FRAMECRC_MUXER) += framecrcenc.o framehash.o + OBJS-$(CONFIG_FRAMEHASH_MUXER) += hashenc.o framehash.o +diff --git a/libavformat/flv.h b/libavformat/flv.h +index 3571b90279..91e0a4140c 100644 +--- a/libavformat/flv.h ++++ b/libavformat/flv.h +@@ -35,6 +35,12 @@ + + #define FLV_VIDEO_FRAMETYPE_OFFSET 4 + ++/* Extended VideoTagHeader ++ * defined in reference link: ++ * https://github.com/veovera/enhanced-rtmp/blob/main/enhanced-rtmp-v1.pdf ++ * */ ++#define FLV_IS_EX_HEADER 0x80 ++ + /* bitmasks to isolate specific values */ + #define FLV_AUDIO_CHANNEL_MASK 0x01 + #define FLV_AUDIO_SAMPLESIZE_MASK 0x02 +@@ -112,6 +118,15 @@ enum { + FLV_CODECID_MPEG4 = 9, + }; + ++enum { ++ PacketTypeSequenceStart = 0, ++ PacketTypeCodedFrames = 1, ++ PacketTypeSequenceEnd = 2, ++ PacketTypeCodedFramesX = 3, ++ PacketTypeMetadata = 4, ++ PacketTypeMPEG2TSSequenceStart = 5, ++}; ++ + enum { + FLV_FRAME_KEY = 1 << FLV_VIDEO_FRAMETYPE_OFFSET, ///< key frame (for AVC, a seekable frame) + FLV_FRAME_INTER = 2 << FLV_VIDEO_FRAMETYPE_OFFSET, ///< inter frame (for AVC, a non-seekable frame) +diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c +index 721f062811..35e198fa15 100644 +--- a/libavformat/flvenc.c ++++ b/libavformat/flvenc.c +@@ -28,6 +28,7 @@ + #include "libavcodec/mpeg4audio.h" + #include "avio.h" + #include "avc.h" ++#include "hevc.h" + #include "avformat.h" + #include "flv.h" + #include "internal.h" +@@ -46,6 +47,7 @@ static const AVCodecTag flv_video_codec_ids[] = { + { AV_CODEC_ID_VP6, FLV_CODECID_VP6 }, + { AV_CODEC_ID_VP6A, FLV_CODECID_VP6A }, + { AV_CODEC_ID_H264, FLV_CODECID_H264 }, ++ { AV_CODEC_ID_HEVC, MKBETAG('h', 'v', 'c', '1') }, + { AV_CODEC_ID_NONE, 0 } + }; + +@@ -489,7 +491,7 @@ static void flv_write_codec_header(AVFormatContext* s, AVCodecParameters* par, i + FLVContext *flv = s->priv_data; + + if (par->codec_id == AV_CODEC_ID_AAC || par->codec_id == AV_CODEC_ID_H264 +- || par->codec_id == AV_CODEC_ID_MPEG4) { ++ || par->codec_id == AV_CODEC_ID_MPEG4 || par->codec_id == AV_CODEC_ID_HEVC) { + int64_t pos; + avio_w8(pb, + par->codec_type == AVMEDIA_TYPE_VIDEO ? +@@ -532,10 +534,19 @@ static void flv_write_codec_header(AVFormatContext* s, AVCodecParameters* par, i + } + avio_write(pb, par->extradata, par->extradata_size); + } else { +- avio_w8(pb, par->codec_tag | FLV_FRAME_KEY); // flags +- avio_w8(pb, 0); // AVC sequence header +- avio_wb24(pb, 0); // composition time +- ff_isom_write_avcc(pb, par->extradata, par->extradata_size); ++ if (par->codec_id == AV_CODEC_ID_HEVC) { ++ avio_w8(pb, FLV_IS_EX_HEADER | PacketTypeSequenceStart); // ExVideoTagHeader mode with PacketTypeSequenceStart ++ avio_write(pb, "hvc1", 4); ++ } else { ++ avio_w8(pb, par->codec_tag | FLV_FRAME_KEY); // flags ++ avio_w8(pb, 0); // AVC sequence header ++ avio_wb24(pb, 0); // composition time ++ } ++ ++ if (par->codec_id == AV_CODEC_ID_HEVC) ++ ff_isom_write_hvcc(pb, par->extradata, par->extradata_size, 0); ++ else ++ ff_isom_write_avcc(pb, par->extradata, par->extradata_size); + } + data_size = avio_tell(pb) - pos; + avio_seek(pb, -data_size - 10, SEEK_CUR); +@@ -832,13 +843,13 @@ static int flv_write_packet(AVFormatContext *s, AVPacket *pkt) + if (par->codec_id == AV_CODEC_ID_VP6F || par->codec_id == AV_CODEC_ID_VP6A || + par->codec_id == AV_CODEC_ID_VP6 || par->codec_id == AV_CODEC_ID_AAC) + flags_size = 2; +- else if (par->codec_id == AV_CODEC_ID_H264 || par->codec_id == AV_CODEC_ID_MPEG4) ++ else if (par->codec_id == AV_CODEC_ID_H264 || par->codec_id == AV_CODEC_ID_MPEG4 || par->codec_id == AV_CODEC_ID_HEVC) + flags_size = 5; + else + flags_size = 1; + + if (par->codec_id == AV_CODEC_ID_AAC || par->codec_id == AV_CODEC_ID_H264 +- || par->codec_id == AV_CODEC_ID_MPEG4) { ++ || par->codec_id == AV_CODEC_ID_MPEG4 || par->codec_id == AV_CODEC_ID_HEVC) { + size_t side_size; + uint8_t *side = av_packet_get_side_data(pkt, AV_PKT_DATA_NEW_EXTRADATA, &side_size); + if (side && side_size > 0 && (side_size != par->extradata_size || memcmp(side, par->extradata, side_size))) { +@@ -858,7 +869,7 @@ static int flv_write_packet(AVFormatContext *s, AVPacket *pkt) + "Packets are not in the proper order with respect to DTS\n"); + return AVERROR(EINVAL); + } +- if (par->codec_id == AV_CODEC_ID_H264 || par->codec_id == AV_CODEC_ID_MPEG4) { ++ if (par->codec_id == AV_CODEC_ID_H264 || par->codec_id == AV_CODEC_ID_MPEG4 || par->codec_id == AV_CODEC_ID_HEVC) { + if (pkt->pts == AV_NOPTS_VALUE) { + av_log(s, AV_LOG_ERROR, "Packet is missing PTS\n"); + return AVERROR(EINVAL); +@@ -903,6 +914,10 @@ static int flv_write_packet(AVFormatContext *s, AVPacket *pkt) + if (par->extradata_size > 0 && *(uint8_t*)par->extradata != 1) + if ((ret = ff_avc_parse_nal_units_buf(pkt->data, &data, &size)) < 0) + return ret; ++ } else if (par->codec_id == AV_CODEC_ID_HEVC) { ++ if (par->extradata_size > 0 && *(uint8_t*)par->extradata != 1) ++ if ((ret = ff_hevc_annexb2mp4_buf(pkt->data, &data, &size, 0, NULL)) < 0) ++ return ret; + } else if (par->codec_id == AV_CODEC_ID_AAC && pkt->size > 2 && + (AV_RB16(pkt->data) & 0xfff0) == 0xfff0) { + if (!s->streams[pkt->stream_index]->nb_frames) { +@@ -964,7 +979,12 @@ static int flv_write_packet(AVFormatContext *s, AVPacket *pkt) + avio_wb32(pb, data_size + 11); + } else { + av_assert1(flags>=0); +- avio_w8(pb,flags); ++ if (par->codec_id == AV_CODEC_ID_HEVC) { ++ avio_w8(pb, FLV_IS_EX_HEADER | PacketTypeCodedFramesX); // ExVideoTagHeader mode with PacketTypeCodedFramesX ++ avio_write(pb, "hvc1", 4); ++ } else { ++ avio_w8(pb, flags); ++ } + if (par->codec_id == AV_CODEC_ID_VP6) + avio_w8(pb,0); + if (par->codec_id == AV_CODEC_ID_VP6F || par->codec_id == AV_CODEC_ID_VP6A) { + +From patchwork Mon May 15 08:31:57 2023 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +X-Patchwork-Submitter: Steven Liu +X-Patchwork-Id: 41616 +Delivered-To: ffmpegpatchwork2@gmail.com +Received: by 2002:a05:6a20:ba91:b0:105:feb:71f2 with SMTP id + fb17csp1444123pzb; + Mon, 15 May 2023 01:33:22 -0700 (PDT) +X-Google-Smtp-Source: + ACHHUZ4qSqnHARATYvNTOiXhMIIgGWUHo612wN3Ui1r3cYPQd57E+B9kiCRYijDhzgObKMKkDm54 +X-Received: by 2002:a17:907:6e8e:b0:94f:3521:396 with SMTP id + sh14-20020a1709076e8e00b0094f35210396mr35740883ejc.23.1684139602011; + Mon, 15 May 2023 01:33:22 -0700 (PDT) +ARC-Seal: i=1; a=rsa-sha256; t=1684139601; cv=none; + d=google.com; s=arc-20160816; + b=EFJgx9cm5ew2+PIpTeHi7QCzos//oOs5q/HndQxc0+dHYlju5X4rVSACmfk9L0DH3j + +cG0n2/3wAsguA1rC3B8a+qXkRfAXC1ropuhDwKCZCdw0Iv40Vm4JeHolEQWRni8Ko+F + MhWY7AvxrX4GsO0pp4SfKsVFaJdo18dlpn+BUd9FX5N7V6lUTadQsVcJYJBd2B2MIRUi + mJaEPp8WpRkiS92DgWhPzUC9ELnwrySnNL0mOo9DCd9cjFXQ9KXW6qjRoP0blbL8N2ws + BlY2dJVmSM36n/GK9gZb+6fUg3xVufDUfdRr0m4jpa/ILD93/nwAZsqhk3k4j00se+CO + 7Vrw== +ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; + s=arc-20160816; + h=sender:errors-to:content-transfer-encoding:cc:reply-to + :list-subscribe:list-help:list-post:list-archive:list-unsubscribe + :list-id:precedence:subject:feedback-id:mime-version:references + :in-reply-to:message-id:date:to:from:delivered-to; + bh=ygUb60Tr5LbPnhiS1As+hL+qX45KII+ocpY9X3Jq4TI=; + b=UpGhqbfo/+m9WW5qE92LKOdOlxkCWyy2QVqiXCjXpxepdDd0IKkhGqSspte9zJrUT8 + QWg8IiDK6JTnGnvp+hO6doZjhXc1GyyTx6cMQQX+2JzqTtbWF03S94GwBgmN/U2RIK9M + f980SSgfNZRSJF5kJ+dO2ix4M5WIWhxEYB/MRzn/RbxAvYkwLNG1gMMBTNimogbFsXRo + h5WgGxO4k8mx/x8PBrtNv1aPZ86FAcXC3Aieao7aVnRDvWjepEus5jEfGu2QuqnvM2qK + WIjUyFrppJL/crANtgR+tFcL8395bRGYObYtIBblUQ/g5ddHzjsaClJ/42r3h1vez39q + nPjQ== +ARC-Authentication-Results: i=1; mx.google.com; + spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org + designates 79.124.17.100 as permitted sender) + smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org +Return-Path: +Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) + by mx.google.com with ESMTP id + v21-20020a1709060b5500b0095ec54a22bcsi10907595ejg.106.2023.05.15.01.33.21; + Mon, 15 May 2023 01:33:21 -0700 (PDT) +Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org + designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; +Authentication-Results: mx.google.com; + spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org + designates 79.124.17.100 as permitted sender) + smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org +Received: from [127.0.1.1] (localhost [127.0.0.1]) + by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id D3F7668C092; + Mon, 15 May 2023 11:33:18 +0300 (EEST) +X-Original-To: ffmpeg-devel@ffmpeg.org +Delivered-To: ffmpeg-devel@ffmpeg.org +Received: from bg4.exmail.qq.com (bg4.exmail.qq.com [43.155.67.158]) + by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8180368C004 + for ; Mon, 15 May 2023 11:33:11 +0300 (EEST) +X-QQ-mid: bizesmtp62t1684139585txhp32ou +Received: from localhost ( [103.102.203.204]) by bizesmtp.qq.com (ESMTP) with + id ; Mon, 15 May 2023 16:33:04 +0800 (CST) +X-QQ-SSF: 01100000000000Z0Z000000A0000000 +X-QQ-FEAT: 6ArnuSDJ+inVC06MH1nrJeu56+35diptW3dCdHt3bMayFZoCyE8QyUO0QY9zm + iY62JCSpSKYEK4ca2kpxkB99PI50FiWfNtzLDZ+VzUTy013GMpLwh1CWeVX5cF15RyEAIC9 + u3Ozg7IY8mv+GiDtf6FDgSyumE1D93qxV1R2sJ5v38V3NbNPcikg0aDxZXOlC+Hr+LdhsZi + 4X5tDi3NovhpCf+8Wo+ZaejHOrE8MUcUGpbh8dHRew6dnmkdkK5ytSHSZEye8RsXZnMdp4A + mqBZqIDGw1a4e04JAc/NDCs7qq4qthxMFB1skhaOv6DLcL+EqV2QFwnJn7V5Oof7BwfjaTG + mEAVpiZDnQhFvOgHemH1v61Blub2nCnAurrGhGMaywIzFXT87aOSLCDlFprSg== +X-QQ-GoodBg: 0 +X-BIZMAIL-ID: 11210839191292587357 +From: Steven Liu +To: ffmpeg-devel@ffmpeg.org +Date: Mon, 15 May 2023 16:31:57 +0800 +Message-Id: <20230515083201.48201-3-lq@chinaffmpeg.org> +X-Mailer: git-send-email 2.40.0 +In-Reply-To: <20230515083201.48201-1-lq@chinaffmpeg.org> +References: + + <20230515083201.48201-1-lq@chinaffmpeg.org> +MIME-Version: 1.0 +X-QQ-SENDSIZE: 520 +Feedback-ID: bizesmtp:chinaffmpeg.org:qybglogicsvrsz:qybglogicsvrsz3a-3 +Subject: [FFmpeg-devel] [PATCH v10 2/6] avformat/flvdec: support demux hevc + in enhanced flv +X-BeenThere: ffmpeg-devel@ffmpeg.org +X-Mailman-Version: 2.1.29 +Precedence: list +List-Id: FFmpeg development discussions and patches +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +Reply-To: FFmpeg development discussions and patches +Cc: Steven Liu +Errors-To: ffmpeg-devel-bounces@ffmpeg.org +Sender: "ffmpeg-devel" +X-TUID: SFsjHMHu2ISl + +Signed-off-by: Steven Liu +--- + libavformat/flvdec.c | 58 ++++++++++++++++++++++++++++++++++++++------ + 1 file changed, 50 insertions(+), 8 deletions(-) + +diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c +index d83edff727..c8e6cadf1c 100644 +--- a/libavformat/flvdec.c ++++ b/libavformat/flvdec.c +@@ -79,6 +79,8 @@ typedef struct FLVContext { + int64_t last_ts; + int64_t time_offset; + int64_t time_pos; ++ ++ uint8_t exheader; + } FLVContext; + + /* AMF date type */ +@@ -302,13 +304,25 @@ static void flv_set_audio_codec(AVFormatContext *s, AVStream *astream, + } + } + +-static int flv_same_video_codec(AVCodecParameters *vpar, int flags) ++static int flv_same_video_codec(AVFormatContext *s, AVCodecParameters *vpar, int flags) + { + int flv_codecid = flags & FLV_VIDEO_CODECID_MASK; ++ FLVContext *flv = s->priv_data; + + if (!vpar->codec_id && !vpar->codec_tag) + return 1; + ++ if (flv->exheader) { ++ uint8_t *codec_id_str = (uint8_t *)s->pb->buf_ptr; ++ uint32_t codec_id = codec_id_str[3] | codec_id_str[2] << 8 | codec_id_str[1] << 16 | codec_id_str[0] << 24; ++ switch(codec_id) { ++ case MKBETAG('h', 'v', 'c', '1'): ++ return vpar->codec_id == AV_CODEC_ID_HEVC; ++ default: ++ break; ++ } ++ } ++ + switch (flv_codecid) { + case FLV_CODECID_H263: + return vpar->codec_id == AV_CODEC_ID_FLV1; +@@ -331,9 +345,24 @@ static int flv_set_video_codec(AVFormatContext *s, AVStream *vstream, + int flv_codecid, int read) + { + FFStream *const vstreami = ffstream(vstream); ++ FLVContext *flv = s->priv_data; + int ret = 0; + AVCodecParameters *par = vstream->codecpar; + enum AVCodecID old_codec_id = vstream->codecpar->codec_id; ++ flv_codecid &= FLV_VIDEO_CODECID_MASK; ++ ++ if (flv->exheader) { ++ uint32_t codec_id = avio_rb32(s->pb); ++ ++ switch(codec_id) { ++ case MKBETAG('h', 'v', 'c', '1'): ++ par->codec_id = AV_CODEC_ID_HEVC; ++ vstreami->need_parsing = AVSTREAM_PARSE_HEADERS; ++ return 4; ++ default: ++ break; ++ } ++ } + switch (flv_codecid) { + case FLV_CODECID_H263: + par->codec_id = AV_CODEC_ID_FLV1; +@@ -796,6 +825,7 @@ static int flv_read_header(AVFormatContext *s) + s->start_time = 0; + flv->sum_flv_tag_size = 0; + flv->last_keyframe_stream_index = -1; ++ flv->exheader = 0; + + return 0; + } +@@ -1071,6 +1101,11 @@ retry: + } else if (type == FLV_TAG_TYPE_VIDEO) { + stream_type = FLV_STREAM_TYPE_VIDEO; + flags = avio_r8(s->pb); ++ /* ++ * Reference Enhancing FLV 2023-03-v1.0.0-B.8 ++ * https://github.com/veovera/enhanced-rtmp/blob/main/enhanced-rtmp-v1.pdf ++ * */ ++ flv->exheader = (flags >> 7) & 1; + size--; + if ((flags & FLV_VIDEO_FRAMETYPE_MASK) == FLV_FRAME_VIDEO_INFO_CMD) + goto skip; +@@ -1129,7 +1164,7 @@ skip: + break; + } else if (stream_type == FLV_STREAM_TYPE_VIDEO) { + if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && +- (s->video_codec_id || flv_same_video_codec(st->codecpar, flags))) ++ (s->video_codec_id || flv_same_video_codec(s, st->codecpar, flags))) + break; + } else if (stream_type == FLV_STREAM_TYPE_SUBTITLE) { + if (st->codecpar->codec_type == AVMEDIA_TYPE_SUBTITLE) +@@ -1230,7 +1265,7 @@ retry_duration: + avcodec_parameters_free(&par); + } + } else if (stream_type == FLV_STREAM_TYPE_VIDEO) { +- int ret = flv_set_video_codec(s, st, flags & FLV_VIDEO_CODECID_MASK, 1); ++ int ret = flv_set_video_codec(s, st, flags, 1); + if (ret < 0) + return ret; + size -= ret; +@@ -1242,16 +1277,23 @@ retry_duration: + + if (st->codecpar->codec_id == AV_CODEC_ID_AAC || + st->codecpar->codec_id == AV_CODEC_ID_H264 || +- st->codecpar->codec_id == AV_CODEC_ID_MPEG4) { +- int type = avio_r8(s->pb); +- size--; ++ st->codecpar->codec_id == AV_CODEC_ID_MPEG4 || ++ st->codecpar->codec_id == AV_CODEC_ID_HEVC) { ++ int type = 0; ++ if (flv->exheader && stream_type == FLV_STREAM_TYPE_VIDEO) { ++ type = flags & 0x0F; ++ } else { ++ type = avio_r8(s->pb); ++ size--; ++ } + + if (size < 0) { + ret = AVERROR_INVALIDDATA; + goto leave; + } + +- if (st->codecpar->codec_id == AV_CODEC_ID_H264 || st->codecpar->codec_id == AV_CODEC_ID_MPEG4) { ++ if (st->codecpar->codec_id == AV_CODEC_ID_H264 || st->codecpar->codec_id == AV_CODEC_ID_MPEG4 || ++ (st->codecpar->codec_id == AV_CODEC_ID_HEVC && type == PacketTypeCodedFrames)) { + // sign extension + int32_t cts = (avio_rb24(s->pb) + 0xff800000) ^ 0xff800000; + pts = av_sat_add64(dts, cts); +@@ -1267,7 +1309,7 @@ retry_duration: + } + } + if (type == 0 && (!st->codecpar->extradata || st->codecpar->codec_id == AV_CODEC_ID_AAC || +- st->codecpar->codec_id == AV_CODEC_ID_H264)) { ++ st->codecpar->codec_id == AV_CODEC_ID_H264 || st->codecpar->codec_id == AV_CODEC_ID_HEVC)) { + AVDictionaryEntry *t; + + if (st->codecpar->extradata) { + +From patchwork Mon May 15 08:31:58 2023 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +X-Patchwork-Submitter: Steven Liu +X-Patchwork-Id: 41617 +Delivered-To: ffmpegpatchwork2@gmail.com +Received: by 2002:a05:6a20:ba91:b0:105:feb:71f2 with SMTP id + fb17csp1444209pzb; + Mon, 15 May 2023 01:33:31 -0700 (PDT) +X-Google-Smtp-Source: + ACHHUZ5N/MWld9fXzokkRVS1e13AYakkRyH/RvyBiJ7xA512EWdWgrGE4ferugcTRoHNahvjayC9 +X-Received: by 2002:a17:907:9724:b0:96a:1260:dbf5 with SMTP id + jg36-20020a170907972400b0096a1260dbf5mr18082554ejc.45.1684139611447; + Mon, 15 May 2023 01:33:31 -0700 (PDT) +ARC-Seal: i=1; a=rsa-sha256; t=1684139611; cv=none; + d=google.com; s=arc-20160816; + b=op6Xl3YinOSd8d/Ya4YpQjHSbJx0t7fHaCHvvqvkJgTbKfjmTJjDFsMWkeT/ceA1lA + xV9Y1JGrAlZmudpgaJtXHukLJessnBrqaBy5gm0lX6bJ0X4AKJt/F7GB3FR3OPISq79w + 7djeHUx2VAxfWn1awCcFrcyyMPrGB2GPMdoXxcUVmySNNK0ohuroQ2JhVRajwj0sIBFg + f0pu7vXX9ct499tFl5rHEd//2Xl3rY6kNHfPlMOcJEclT+35TUaTWE88+rJODaiMArcZ + RaFK8xqfAOJjw0X9t6YiwBk1Kl/sFKEj71Fxu5khg7IvhF7kzRDSZXLCkKW9UvPYhGOl + 25Bw== +ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; + s=arc-20160816; + h=sender:errors-to:content-transfer-encoding:cc:reply-to + :list-subscribe:list-help:list-post:list-archive:list-unsubscribe + :list-id:precedence:subject:feedback-id:mime-version:references + :in-reply-to:message-id:date:to:from:delivered-to; + bh=0O0kUGD5r8lgXEiC2RUfiZ1ccVRPd03lWds0dqdVEq0=; + b=OAvZATeoNq/BI3pJd21Xz2nKh+ZI8Zkofe4Ob6USu1ZEOyZzK2xxgtxL6SjJAxecG6 + NfECg8e13DLbnVAB5OnMK8TY/HV/4N/iqPksn6PbJSkCyafRqg477+SRs7tOl89c3isr + Cp8o+j7t+gW2fkV9Y6L8MZa9etJpusa0LYXVBLPDs+tHNgXNec9UTA1YnoSyMqErrh58 + chMh6B6P+5aRcKrBfKZY1F8WAzMjphdQ78c3YZ+ikgGfkoPgRKTEUq+xQAMm7UXirMcn + qtndeDiQypN1eg7LiEbAsLhj7K2jibIlDmwUk+6JDE1ASz05FViAbk3nFfWydNP8iUlh + z+CQ== +ARC-Authentication-Results: i=1; mx.google.com; + spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org + designates 79.124.17.100 as permitted sender) + smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org +Return-Path: +Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) + by mx.google.com with ESMTP id + rv22-20020a17090710d600b00965e8c67d7dsi11399192ejb.285.2023.05.15.01.33.31; + Mon, 15 May 2023 01:33:31 -0700 (PDT) +Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org + designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; +Authentication-Results: mx.google.com; + spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org + designates 79.124.17.100 as permitted sender) + smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org +Received: from [127.0.1.1] (localhost [127.0.0.1]) + by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id CAF3668C08B; + Mon, 15 May 2023 11:33:22 +0300 (EEST) +X-Original-To: ffmpeg-devel@ffmpeg.org +Delivered-To: ffmpeg-devel@ffmpeg.org +Received: from bg4.exmail.qq.com (bg4.exmail.qq.com [43.155.67.158]) + by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 5613068C08B + for ; Mon, 15 May 2023 11:33:16 +0300 (EEST) +X-QQ-mid: bizesmtp62t1684139591t5vf5iss +Received: from localhost ( [103.102.203.204]) by bizesmtp.qq.com (ESMTP) with + id ; Mon, 15 May 2023 16:33:09 +0800 (CST) +X-QQ-SSF: 01100000000000Z0Z000000A0000000 +X-QQ-FEAT: 0VYWLLCf4rd8sf4B0xdI45yO9pa7cA5LkUN5r8jryl/9HUTcEOcDnq6sEFLpU + pZ/JnwSIqfqFtRB8Bq8+032WcwZIBdGWmOUpIZLcDlBPHVtS9YwSO56p7te0932mhQHQVWr + 2MJ60EhPcxfhXG3M89QSysYDgLjUIRbb/cP/Br05mCJ05c+Q4NzWwlRwweOG0lUJ4aMNli9 + i3Qf8lSAK8hK3JWYZP0Fg66JaFkZvw6Yz6N4ESVf4Vp85rwWKPfpBz538IiCze/ePbVgZWB + zvbU1mVAkapT05cTLyqAlv7tefflgoYcrW79Z+Opy2wSYDZLpCkRIe+w4yWG7eCg71dUgnc + 79D+MVyHSJjuXS/sQLaeFanS1V55WK4izy9J/bFHdSprmySwmpk8hf5zhIZOQ== +X-QQ-GoodBg: 0 +X-BIZMAIL-ID: 5377996165340525619 +From: Steven Liu +To: ffmpeg-devel@ffmpeg.org +Date: Mon, 15 May 2023 16:31:58 +0800 +Message-Id: <20230515083201.48201-4-lq@chinaffmpeg.org> +X-Mailer: git-send-email 2.40.0 +In-Reply-To: <20230515083201.48201-1-lq@chinaffmpeg.org> +References: + + <20230515083201.48201-1-lq@chinaffmpeg.org> +MIME-Version: 1.0 +X-QQ-SENDSIZE: 520 +Feedback-ID: bizesmtp:chinaffmpeg.org:qybglogicsvrsz:qybglogicsvrsz3a-3 +Subject: [FFmpeg-devel] [PATCH v10 3/6] avformat/flvenc: support mux av1 in + enhanced flv +X-BeenThere: ffmpeg-devel@ffmpeg.org +X-Mailman-Version: 2.1.29 +Precedence: list +List-Id: FFmpeg development discussions and patches +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +Reply-To: FFmpeg development discussions and patches +Cc: Steven Liu +Errors-To: ffmpeg-devel-bounces@ffmpeg.org +Sender: "ffmpeg-devel" +X-TUID: dRfPdsIvexzh + +Signed-off-by: Steven Liu +--- + libavformat/Makefile | 2 +- + libavformat/flvenc.c | 22 ++++++++++++++++++---- + 2 files changed, 19 insertions(+), 5 deletions(-) + +diff --git a/libavformat/Makefile b/libavformat/Makefile +index 1ef3d15467..c868e1626c 100644 +--- a/libavformat/Makefile ++++ b/libavformat/Makefile +@@ -214,7 +214,7 @@ OBJS-$(CONFIG_FLAC_MUXER) += flacenc.o flacenc_header.o \ + OBJS-$(CONFIG_FLIC_DEMUXER) += flic.o + OBJS-$(CONFIG_FLV_DEMUXER) += flvdec.o + OBJS-$(CONFIG_LIVE_FLV_DEMUXER) += flvdec.o +-OBJS-$(CONFIG_FLV_MUXER) += flvenc.o avc.o hevc.o ++OBJS-$(CONFIG_FLV_MUXER) += flvenc.o avc.o hevc.o av1.o + OBJS-$(CONFIG_FOURXM_DEMUXER) += 4xm.o + OBJS-$(CONFIG_FRAMECRC_MUXER) += framecrcenc.o framehash.o + OBJS-$(CONFIG_FRAMEHASH_MUXER) += hashenc.o framehash.o +diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c +index 35e198fa15..c1784b332d 100644 +--- a/libavformat/flvenc.c ++++ b/libavformat/flvenc.c +@@ -28,6 +28,7 @@ + #include "libavcodec/mpeg4audio.h" + #include "avio.h" + #include "avc.h" ++#include "av1.h" + #include "hevc.h" + #include "avformat.h" + #include "flv.h" +@@ -48,6 +49,7 @@ static const AVCodecTag flv_video_codec_ids[] = { + { AV_CODEC_ID_VP6A, FLV_CODECID_VP6A }, + { AV_CODEC_ID_H264, FLV_CODECID_H264 }, + { AV_CODEC_ID_HEVC, MKBETAG('h', 'v', 'c', '1') }, ++ { AV_CODEC_ID_AV1, MKBETAG('a', 'v', '0', '1') }, + { AV_CODEC_ID_NONE, 0 } + }; + +@@ -491,7 +493,8 @@ static void flv_write_codec_header(AVFormatContext* s, AVCodecParameters* par, i + FLVContext *flv = s->priv_data; + + if (par->codec_id == AV_CODEC_ID_AAC || par->codec_id == AV_CODEC_ID_H264 +- || par->codec_id == AV_CODEC_ID_MPEG4 || par->codec_id == AV_CODEC_ID_HEVC) { ++ || par->codec_id == AV_CODEC_ID_MPEG4 || par->codec_id == AV_CODEC_ID_HEVC ++ || par->codec_id == AV_CODEC_ID_AV1) { + int64_t pos; + avio_w8(pb, + par->codec_type == AVMEDIA_TYPE_VIDEO ? +@@ -537,6 +540,9 @@ static void flv_write_codec_header(AVFormatContext* s, AVCodecParameters* par, i + if (par->codec_id == AV_CODEC_ID_HEVC) { + avio_w8(pb, FLV_IS_EX_HEADER | PacketTypeSequenceStart); // ExVideoTagHeader mode with PacketTypeSequenceStart + avio_write(pb, "hvc1", 4); ++ } else if (par->codec_id == AV_CODEC_ID_AV1) { ++ avio_w8(pb, FLV_IS_EX_HEADER | PacketTypeSequenceStart); ++ avio_write(pb, "av01", 4); + } else { + avio_w8(pb, par->codec_tag | FLV_FRAME_KEY); // flags + avio_w8(pb, 0); // AVC sequence header +@@ -545,6 +551,8 @@ static void flv_write_codec_header(AVFormatContext* s, AVCodecParameters* par, i + + if (par->codec_id == AV_CODEC_ID_HEVC) + ff_isom_write_hvcc(pb, par->extradata, par->extradata_size, 0); ++ else if (par->codec_id == AV_CODEC_ID_AV1) ++ ff_isom_write_av1c(pb, par->extradata, par->extradata_size, 1); + else + ff_isom_write_avcc(pb, par->extradata, par->extradata_size); + } +@@ -843,13 +851,15 @@ static int flv_write_packet(AVFormatContext *s, AVPacket *pkt) + if (par->codec_id == AV_CODEC_ID_VP6F || par->codec_id == AV_CODEC_ID_VP6A || + par->codec_id == AV_CODEC_ID_VP6 || par->codec_id == AV_CODEC_ID_AAC) + flags_size = 2; +- else if (par->codec_id == AV_CODEC_ID_H264 || par->codec_id == AV_CODEC_ID_MPEG4 || par->codec_id == AV_CODEC_ID_HEVC) ++ else if (par->codec_id == AV_CODEC_ID_H264 || par->codec_id == AV_CODEC_ID_MPEG4 || ++ par->codec_id == AV_CODEC_ID_HEVC || par->codec_id == AV_CODEC_ID_AV1) + flags_size = 5; + else + flags_size = 1; + + if (par->codec_id == AV_CODEC_ID_AAC || par->codec_id == AV_CODEC_ID_H264 +- || par->codec_id == AV_CODEC_ID_MPEG4 || par->codec_id == AV_CODEC_ID_HEVC) { ++ || par->codec_id == AV_CODEC_ID_MPEG4 || par->codec_id == AV_CODEC_ID_HEVC ++ || par->codec_id == AV_CODEC_ID_AV1) { + size_t side_size; + uint8_t *side = av_packet_get_side_data(pkt, AV_PKT_DATA_NEW_EXTRADATA, &side_size); + if (side && side_size > 0 && (side_size != par->extradata_size || memcmp(side, par->extradata, side_size))) { +@@ -869,7 +879,8 @@ static int flv_write_packet(AVFormatContext *s, AVPacket *pkt) + "Packets are not in the proper order with respect to DTS\n"); + return AVERROR(EINVAL); + } +- if (par->codec_id == AV_CODEC_ID_H264 || par->codec_id == AV_CODEC_ID_MPEG4 || par->codec_id == AV_CODEC_ID_HEVC) { ++ if (par->codec_id == AV_CODEC_ID_H264 || par->codec_id == AV_CODEC_ID_MPEG4 || ++ par->codec_id == AV_CODEC_ID_HEVC || par->codec_id == AV_CODEC_ID_AV1) { + if (pkt->pts == AV_NOPTS_VALUE) { + av_log(s, AV_LOG_ERROR, "Packet is missing PTS\n"); + return AVERROR(EINVAL); +@@ -982,6 +993,9 @@ static int flv_write_packet(AVFormatContext *s, AVPacket *pkt) + if (par->codec_id == AV_CODEC_ID_HEVC) { + avio_w8(pb, FLV_IS_EX_HEADER | PacketTypeCodedFramesX); // ExVideoTagHeader mode with PacketTypeCodedFramesX + avio_write(pb, "hvc1", 4); ++ } else if (par->codec_id == AV_CODEC_ID_AV1) { ++ avio_w8(pb, FLV_IS_EX_HEADER | PacketTypeCodedFrames); ++ avio_write(pb, "av01", 4); + } else { + avio_w8(pb, flags); + } + +From patchwork Mon May 15 08:31:59 2023 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +X-Patchwork-Submitter: Steven Liu +X-Patchwork-Id: 41618 +Delivered-To: ffmpegpatchwork2@gmail.com +Received: by 2002:a05:6a20:ba91:b0:105:feb:71f2 with SMTP id + fb17csp1444290pzb; + Mon, 15 May 2023 01:33:41 -0700 (PDT) +X-Google-Smtp-Source: + ACHHUZ7k5HSYVpKlutDCH3BVN03oQ1eQ9NWjKwBebLGv5fK0d2qVGGgCtBo3XdEGlDTDUuvlDzRX +X-Received: by 2002:a17:907:9347:b0:94f:322d:909c with SMTP id + bv7-20020a170907934700b0094f322d909cmr26994118ejc.34.1684139620986; + Mon, 15 May 2023 01:33:40 -0700 (PDT) +ARC-Seal: i=1; a=rsa-sha256; t=1684139620; cv=none; + d=google.com; s=arc-20160816; + b=BBSgegXR1u0K767R9MAxQddt49hZNhDS+YgCHGYo0B07ClteK018739TK9tupVh7pK + wuvk/gzkEpIZpf2I3LQnpaxvQx0ZnllSKyz+x+560wEVKkQw5tlwpgr4qA3m0ApBBmQR + 2ZUu6WRpBnVeXJbT5n+ymITrLd1NVXLNPqoz7kL0iDML0b2iC9PqCoGRTHF6zJZFtCH2 + ZYUq4OdcbflvqqLBvKvSgEwuVof0bqDwD8kfq9noKTf7wrx5bcdIbq6XMYG1n6AnPq7R + R+ekmhosFoZ7IgohAkj9k8j6l4ipCc6yVN2M8TN1TfTwRC01vzz+SRYOXZWLNb0eqZzh + Zp2A== +ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; + s=arc-20160816; + h=sender:errors-to:content-transfer-encoding:cc:reply-to + :list-subscribe:list-help:list-post:list-archive:list-unsubscribe + :list-id:precedence:subject:feedback-id:mime-version:references + :in-reply-to:message-id:date:to:from:delivered-to; + bh=J5hIt8/6l7983HWQOAGA1qy6mjWmMWu6DJ2RZRfJeuQ=; + b=rX88kWHJtUiqnNutEQCOwUvfl5lV/FVHviaDHIsiatvB92XG71pgeFVXopTjJ+st3F + lu+/rKnYKAVXFqF4WHMP6bu0VT5bFE2A9806gTD5Rf1D2yGVjKWRH8fhY6Jl2KhEhQA+ + Efc6fMZ2qZRmdx5S2INE2k+sY3zgWZsFkv2NDowFLnjnpmTGneVW82ybCbL06DRH7Jts + wxWDfFfTqnp2VNwD0C462f5ogLB8cH7f9uoFviTovEYcXc8iLpHP38cJa3hdAuJg972S + cgjJSuZUaQ38bqmw7th2MDkaFSzryck0wafneRdJUxyKG7ltbwk4hgAz89yzUB7nZeU6 + yucA== +ARC-Authentication-Results: i=1; mx.google.com; + spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org + designates 79.124.17.100 as permitted sender) + smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org +Return-Path: +Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) + by mx.google.com with ESMTP id + gv41-20020a1709072be900b00965f171543esi11575148ejc.148.2023.05.15.01.33.40; + Mon, 15 May 2023 01:33:40 -0700 (PDT) +Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org + designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; +Authentication-Results: mx.google.com; + spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org + designates 79.124.17.100 as permitted sender) + smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org +Received: from [127.0.1.1] (localhost [127.0.0.1]) + by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id D65AD68C0A8; + Mon, 15 May 2023 11:33:29 +0300 (EEST) +X-Original-To: ffmpeg-devel@ffmpeg.org +Delivered-To: ffmpeg-devel@ffmpeg.org +Received: from bg4.exmail.qq.com (bg4.exmail.qq.com [43.155.67.158]) + by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 5AA6768C09F + for ; Mon, 15 May 2023 11:33:22 +0300 (EEST) +X-QQ-mid: bizesmtp75t1684139596t4okf86m +Received: from localhost ( [103.102.203.204]) by bizesmtp.qq.com (ESMTP) with + id ; Mon, 15 May 2023 16:33:15 +0800 (CST) +X-QQ-SSF: 01100000000000Z0Z000000A0000000 +X-QQ-FEAT: KvvwR/hcPA3wY6H84uX1Z4OhW9I2bQ1QV35znBz44h8GZ/oUuMaFpDcrT3dSg + MUkTVTMEyhXhHNx2JIMxfw5+q/3TCUtvnKXsxLZtQsy/0Nq/y+p0xVsHJzQmM8CvbT6L6Q3 + OmxwvGAO6ljvI/iA+SXU+3+HUNyetDE8UTRW1ZGCtG9iJRbK9wXPoiAMzLepT2+CHGO2brq + CwH6RA/e9/I4xOHLleywtC4oDlPuyHovxzzedsBTrXYic5tb0+D65abc6NjfHr7zrYD/DQu + HY0NNweX9YP/jE8jJ0TPLhcx7wighw+KDFbYf+UcUuaPHhzfAZh2f6aplibzVuvV78OPq2S + thQ/XeMGf/W9C/Oy4Eq145+G+pUQ7zx/OKY8Jj/33dmvwZkUr8= +X-QQ-GoodBg: 0 +X-BIZMAIL-ID: 9530387995930120932 +From: Steven Liu +To: ffmpeg-devel@ffmpeg.org +Date: Mon, 15 May 2023 16:31:59 +0800 +Message-Id: <20230515083201.48201-5-lq@chinaffmpeg.org> +X-Mailer: git-send-email 2.40.0 +In-Reply-To: <20230515083201.48201-1-lq@chinaffmpeg.org> +References: + + <20230515083201.48201-1-lq@chinaffmpeg.org> +MIME-Version: 1.0 +X-QQ-SENDSIZE: 520 +Feedback-ID: bizesmtp:chinaffmpeg.org:qybglogicsvrsz:qybglogicsvrsz3a-3 +Subject: [FFmpeg-devel] [PATCH v10 4/6] avformat/flvdec: support demux av1 + in enhanced flv +X-BeenThere: ffmpeg-devel@ffmpeg.org +X-Mailman-Version: 2.1.29 +Precedence: list +List-Id: FFmpeg development discussions and patches +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +Reply-To: FFmpeg development discussions and patches +Cc: Steven Liu +Errors-To: ffmpeg-devel-bounces@ffmpeg.org +Sender: "ffmpeg-devel" +X-TUID: MKqjViniwIy+ + +Signed-off-by: Steven Liu +--- + libavformat/flvdec.c | 12 ++++++++++-- + 1 file changed, 10 insertions(+), 2 deletions(-) + +diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c +index c8e6cadf1c..a0362ff11c 100644 +--- a/libavformat/flvdec.c ++++ b/libavformat/flvdec.c +@@ -318,6 +318,8 @@ static int flv_same_video_codec(AVFormatContext *s, AVCodecParameters *vpar, int + switch(codec_id) { + case MKBETAG('h', 'v', 'c', '1'): + return vpar->codec_id == AV_CODEC_ID_HEVC; ++ case MKBETAG('a', 'v', '0', '1'): ++ return vpar->codec_id == AV_CODEC_ID_AV1; + default: + break; + } +@@ -359,6 +361,10 @@ static int flv_set_video_codec(AVFormatContext *s, AVStream *vstream, + par->codec_id = AV_CODEC_ID_HEVC; + vstreami->need_parsing = AVSTREAM_PARSE_HEADERS; + return 4; ++ case MKBETAG('a', 'v', '0', '1'): ++ par->codec_id = AV_CODEC_ID_AV1; ++ vstreami->need_parsing = AVSTREAM_PARSE_HEADERS; ++ return 4; + default: + break; + } +@@ -1278,7 +1284,8 @@ retry_duration: + if (st->codecpar->codec_id == AV_CODEC_ID_AAC || + st->codecpar->codec_id == AV_CODEC_ID_H264 || + st->codecpar->codec_id == AV_CODEC_ID_MPEG4 || +- st->codecpar->codec_id == AV_CODEC_ID_HEVC) { ++ st->codecpar->codec_id == AV_CODEC_ID_HEVC || ++ st->codecpar->codec_id == AV_CODEC_ID_AV1) { + int type = 0; + if (flv->exheader && stream_type == FLV_STREAM_TYPE_VIDEO) { + type = flags & 0x0F; +@@ -1309,7 +1316,8 @@ retry_duration: + } + } + if (type == 0 && (!st->codecpar->extradata || st->codecpar->codec_id == AV_CODEC_ID_AAC || +- st->codecpar->codec_id == AV_CODEC_ID_H264 || st->codecpar->codec_id == AV_CODEC_ID_HEVC)) { ++ st->codecpar->codec_id == AV_CODEC_ID_H264 || st->codecpar->codec_id == AV_CODEC_ID_HEVC || ++ st->codecpar->codec_id == AV_CODEC_ID_AV1)) { + AVDictionaryEntry *t; + + if (st->codecpar->extradata) { + +From patchwork Mon May 15 08:32:00 2023 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +X-Patchwork-Submitter: Steven Liu +X-Patchwork-Id: 41619 +Delivered-To: ffmpegpatchwork2@gmail.com +Received: by 2002:a05:6a20:ba91:b0:105:feb:71f2 with SMTP id + fb17csp1444532pzb; + Mon, 15 May 2023 01:34:10 -0700 (PDT) +X-Google-Smtp-Source: + ACHHUZ4QlFqXMa0WNHK3Z3HLgPm2UskuQZX2wmbFhYm+ZL0BsDRPhLxJboG0YhDPFi999aVCQZE+ +X-Received: by 2002:a05:6402:14c3:b0:50d:fcfb:8633 with SMTP id + f3-20020a05640214c300b0050dfcfb8633mr9613789edx.9.1684139650196; + Mon, 15 May 2023 01:34:10 -0700 (PDT) +ARC-Seal: i=1; a=rsa-sha256; t=1684139650; cv=none; + d=google.com; s=arc-20160816; + b=sjfm4xhTPqjGNyHlxS3/kMPilx13EB+7S0YxjOI5lR9MMg8Sy3KgL187C6tuZqUwoZ + dJo7A3q41EK4WJyWTTUyqUOr8q8JPjbBTCJpVsERuMuMWpHrhQxvwEDibvfuDI0ZI2vK + y5pqRZ23OMNZLCC+fsc85gQDKPgvkYZTYisSOsWVRiZQGl04TipfZE1Uza8R7ZEXRgdH + ZW770YcfzVXmKKzralH4thSFhGfMZRpX7kj6oBtmpUco4Z6iu42o3iBTcaioGBzdWdPY + KL94WAIaMnCyO1JJaUAJGzEcQTGhPbXUzG7JvmqEwSa168GBSEjQJ3qJc8oOr+UVWcvn + HvaQ== +ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; + s=arc-20160816; + h=sender:errors-to:content-transfer-encoding:cc:reply-to + :list-subscribe:list-help:list-post:list-archive:list-unsubscribe + :list-id:precedence:subject:feedback-id:mime-version:references + :in-reply-to:message-id:date:to:from:delivered-to; + bh=b1Sp5oqZAMwakI7a3Zvw4MdnKPyomZo8cXqDnyJamjg=; + b=jcFJOli16NPqGPnMDcJVER3TEkWreNJ2Vu7711GhJhFkmXLNFhS2FUAoT9QBTy+JWm + jxaBjiVvs1MMQ+a3k3yT7AzVSUMMDDSagiE/jWzQ+vBN9dr/jQOMtJWxwfm4oTbBc0/r + GcHTgPKB2HvEiLOWaJ4CSfZcYBvosoew/IfPgKm06P2Btmc+faSXLCZ63nKEVTq7NCpx + qllJPkFmvlwB/+soxN7nZgTzXm/uurSOBMajImRGPOZUOZQE1I5Tk8OtJXZP6QtlSvXT + ZcglewhTYuHlAXbpT4sYyddMwKg9yPu6/Wmrol/wg3QpXPZ0lVtLeTozus/2UTISJrR5 + Lp3Q== +ARC-Authentication-Results: i=1; mx.google.com; + spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org + designates 79.124.17.100 as permitted sender) + smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org +Return-Path: +Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) + by mx.google.com with ESMTP id + f25-20020a056402151900b0050bd37278d9si11856925edw.435.2023.05.15.01.34.09; + Mon, 15 May 2023 01:34:10 -0700 (PDT) +Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org + designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; +Authentication-Results: mx.google.com; + spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org + designates 79.124.17.100 as permitted sender) + smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org +Received: from [127.0.1.1] (localhost [127.0.0.1]) + by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 0DB6568C092; + Mon, 15 May 2023 11:34:07 +0300 (EEST) +X-Original-To: ffmpeg-devel@ffmpeg.org +Delivered-To: ffmpeg-devel@ffmpeg.org +Received: from bg4.exmail.qq.com (bg4.exmail.qq.com [43.154.221.58]) + by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 96A14680274 + for ; Mon, 15 May 2023 11:33:59 +0300 (EEST) +X-QQ-mid: bizesmtp76t1684139634tg83beu0 +Received: from localhost ( [103.102.203.204]) by bizesmtp.qq.com (ESMTP) with + id ; Mon, 15 May 2023 16:33:52 +0800 (CST) +X-QQ-SSF: 01100000000000Z0Z000000A0000000 +X-QQ-FEAT: DWSCcwW/aQb83U5Bq9N00w3kkIuofNiUvlQbgR0sgGjFEas+vh7wXyRycFT/z + w33SH7uNRX8lmP+8+iy6jQH/gsaQRVAau2z8K0utdx9GuZMvY0e5SZfB0zBfncb1NdBZJxB + Ptvibavnj2rDlqrGLO9dvFEfmYj1K48HYp6rdjCb+xRPfyOtnct3Zq6ST7F1DxU1+Kmt8cw + 2qVgeA79DNHm1JbcDzi/2W/SpzWHWk/jamN4cAQfKyP9B4AvMPaFd8kdl6akYbR0Q84H73M + Pcx8UXz6iw4sCTSPFzf0zrsI4+shly9KFp4UESTfRbDEJ46pcyw8+6Uz+Q7w+7CRtPlOsms + K6IAbcLwicf/v8Rm2nHdrNPotcaMgY5p7IqmkY/Y/b2feqKiAM= +X-QQ-GoodBg: 0 +X-BIZMAIL-ID: 4611718483056789364 +From: Steven Liu +To: ffmpeg-devel@ffmpeg.org +Date: Mon, 15 May 2023 16:32:00 +0800 +Message-Id: <20230515083201.48201-6-lq@chinaffmpeg.org> +X-Mailer: git-send-email 2.40.0 +In-Reply-To: <20230515083201.48201-1-lq@chinaffmpeg.org> +References: + + <20230515083201.48201-1-lq@chinaffmpeg.org> +MIME-Version: 1.0 +X-QQ-SENDSIZE: 520 +Feedback-ID: bizesmtp:chinaffmpeg.org:qybglogicsvrsz:qybglogicsvrsz3a-3 +Subject: [FFmpeg-devel] [PATCH v10 5/6] avformat/flvenc: support mux vp9 in + enhanced flv +X-BeenThere: ffmpeg-devel@ffmpeg.org +X-Mailman-Version: 2.1.29 +Precedence: list +List-Id: FFmpeg development discussions and patches +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +Reply-To: FFmpeg development discussions and patches +Cc: Steven Liu +Errors-To: ffmpeg-devel-bounces@ffmpeg.org +Sender: "ffmpeg-devel" +X-TUID: appcyLUJeeFW + +Signed-off-by: Steven Liu +--- + libavformat/Makefile | 2 +- + libavformat/flvenc.c | 22 ++++++++++++++-------- + 2 files changed, 15 insertions(+), 9 deletions(-) + +diff --git a/libavformat/Makefile b/libavformat/Makefile +index c868e1626c..16cfe107ea 100644 +--- a/libavformat/Makefile ++++ b/libavformat/Makefile +@@ -214,7 +214,7 @@ OBJS-$(CONFIG_FLAC_MUXER) += flacenc.o flacenc_header.o \ + OBJS-$(CONFIG_FLIC_DEMUXER) += flic.o + OBJS-$(CONFIG_FLV_DEMUXER) += flvdec.o + OBJS-$(CONFIG_LIVE_FLV_DEMUXER) += flvdec.o +-OBJS-$(CONFIG_FLV_MUXER) += flvenc.o avc.o hevc.o av1.o ++OBJS-$(CONFIG_FLV_MUXER) += flvenc.o avc.o hevc.o av1.o vpcc.o + OBJS-$(CONFIG_FOURXM_DEMUXER) += 4xm.o + OBJS-$(CONFIG_FRAMECRC_MUXER) += framecrcenc.o framehash.o + OBJS-$(CONFIG_FRAMEHASH_MUXER) += hashenc.o framehash.o +diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c +index c1784b332d..475dd0bf44 100644 +--- a/libavformat/flvenc.c ++++ b/libavformat/flvenc.c +@@ -29,6 +29,7 @@ + #include "avio.h" + #include "avc.h" + #include "av1.h" ++#include "vpcc.h" + #include "hevc.h" + #include "avformat.h" + #include "flv.h" +@@ -50,6 +51,7 @@ static const AVCodecTag flv_video_codec_ids[] = { + { AV_CODEC_ID_H264, FLV_CODECID_H264 }, + { AV_CODEC_ID_HEVC, MKBETAG('h', 'v', 'c', '1') }, + { AV_CODEC_ID_AV1, MKBETAG('a', 'v', '0', '1') }, ++ { AV_CODEC_ID_VP9, MKBETAG('v', 'p', '0', '9') }, + { AV_CODEC_ID_NONE, 0 } + }; + +@@ -494,7 +496,7 @@ static void flv_write_codec_header(AVFormatContext* s, AVCodecParameters* par, i + + if (par->codec_id == AV_CODEC_ID_AAC || par->codec_id == AV_CODEC_ID_H264 + || par->codec_id == AV_CODEC_ID_MPEG4 || par->codec_id == AV_CODEC_ID_HEVC +- || par->codec_id == AV_CODEC_ID_AV1) { ++ || par->codec_id == AV_CODEC_ID_AV1 || par->codec_id == AV_CODEC_ID_VP9) { + int64_t pos; + avio_w8(pb, + par->codec_type == AVMEDIA_TYPE_VIDEO ? +@@ -540,9 +542,9 @@ static void flv_write_codec_header(AVFormatContext* s, AVCodecParameters* par, i + if (par->codec_id == AV_CODEC_ID_HEVC) { + avio_w8(pb, FLV_IS_EX_HEADER | PacketTypeSequenceStart); // ExVideoTagHeader mode with PacketTypeSequenceStart + avio_write(pb, "hvc1", 4); +- } else if (par->codec_id == AV_CODEC_ID_AV1) { ++ } else if (par->codec_id == AV_CODEC_ID_AV1 || par->codec_id == AV_CODEC_ID_VP9) { + avio_w8(pb, FLV_IS_EX_HEADER | PacketTypeSequenceStart); +- avio_write(pb, "av01", 4); ++ avio_write(pb, par->codec_id == AV_CODEC_ID_AV1 ? "av01" : "vp09", 4); + } else { + avio_w8(pb, par->codec_tag | FLV_FRAME_KEY); // flags + avio_w8(pb, 0); // AVC sequence header +@@ -553,6 +555,8 @@ static void flv_write_codec_header(AVFormatContext* s, AVCodecParameters* par, i + ff_isom_write_hvcc(pb, par->extradata, par->extradata_size, 0); + else if (par->codec_id == AV_CODEC_ID_AV1) + ff_isom_write_av1c(pb, par->extradata, par->extradata_size, 1); ++ else if (par->codec_id == AV_CODEC_ID_VP9) ++ ff_isom_write_vpcc(s, pb, par->extradata, par->extradata_size, par); + else + ff_isom_write_avcc(pb, par->extradata, par->extradata_size); + } +@@ -852,14 +856,15 @@ static int flv_write_packet(AVFormatContext *s, AVPacket *pkt) + par->codec_id == AV_CODEC_ID_VP6 || par->codec_id == AV_CODEC_ID_AAC) + flags_size = 2; + else if (par->codec_id == AV_CODEC_ID_H264 || par->codec_id == AV_CODEC_ID_MPEG4 || +- par->codec_id == AV_CODEC_ID_HEVC || par->codec_id == AV_CODEC_ID_AV1) ++ par->codec_id == AV_CODEC_ID_HEVC || par->codec_id == AV_CODEC_ID_AV1 || ++ par->codec_id == AV_CODEC_ID_VP9) + flags_size = 5; + else + flags_size = 1; + + if (par->codec_id == AV_CODEC_ID_AAC || par->codec_id == AV_CODEC_ID_H264 + || par->codec_id == AV_CODEC_ID_MPEG4 || par->codec_id == AV_CODEC_ID_HEVC +- || par->codec_id == AV_CODEC_ID_AV1) { ++ || par->codec_id == AV_CODEC_ID_AV1 || par->codec_id == AV_CODEC_ID_VP9) { + size_t side_size; + uint8_t *side = av_packet_get_side_data(pkt, AV_PKT_DATA_NEW_EXTRADATA, &side_size); + if (side && side_size > 0 && (side_size != par->extradata_size || memcmp(side, par->extradata, side_size))) { +@@ -880,7 +885,8 @@ static int flv_write_packet(AVFormatContext *s, AVPacket *pkt) + return AVERROR(EINVAL); + } + if (par->codec_id == AV_CODEC_ID_H264 || par->codec_id == AV_CODEC_ID_MPEG4 || +- par->codec_id == AV_CODEC_ID_HEVC || par->codec_id == AV_CODEC_ID_AV1) { ++ par->codec_id == AV_CODEC_ID_HEVC || par->codec_id == AV_CODEC_ID_AV1 || ++ par->codec_id == AV_CODEC_ID_VP9) { + if (pkt->pts == AV_NOPTS_VALUE) { + av_log(s, AV_LOG_ERROR, "Packet is missing PTS\n"); + return AVERROR(EINVAL); +@@ -993,9 +999,9 @@ static int flv_write_packet(AVFormatContext *s, AVPacket *pkt) + if (par->codec_id == AV_CODEC_ID_HEVC) { + avio_w8(pb, FLV_IS_EX_HEADER | PacketTypeCodedFramesX); // ExVideoTagHeader mode with PacketTypeCodedFramesX + avio_write(pb, "hvc1", 4); +- } else if (par->codec_id == AV_CODEC_ID_AV1) { ++ } else if (par->codec_id == AV_CODEC_ID_AV1 || par->codec_id == AV_CODEC_ID_VP9) { + avio_w8(pb, FLV_IS_EX_HEADER | PacketTypeCodedFrames); +- avio_write(pb, "av01", 4); ++ avio_write(pb, par->codec_id == AV_CODEC_ID_AV1 ? "av01" : "vp09", 4); + } else { + avio_w8(pb, flags); + } + +From patchwork Mon May 15 08:32:01 2023 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +X-Patchwork-Submitter: Steven Liu +X-Patchwork-Id: 41620 +Delivered-To: ffmpegpatchwork2@gmail.com +Received: by 2002:a05:6a20:ba91:b0:105:feb:71f2 with SMTP id + fb17csp1444616pzb; + Mon, 15 May 2023 01:34:19 -0700 (PDT) +X-Google-Smtp-Source: + ACHHUZ4K6eOJwwn7jPfy0dhTP4IQr2XzDB8PfB7Er6aQtrCrxnddiRIgdBqZB72dHhyqfbILXd5E +X-Received: by 2002:a17:906:ee8e:b0:95e:c549:9ace with SMTP id + wt14-20020a170906ee8e00b0095ec5499acemr28082182ejb.62.1684139659496; + Mon, 15 May 2023 01:34:19 -0700 (PDT) +ARC-Seal: i=1; a=rsa-sha256; t=1684139659; cv=none; + d=google.com; s=arc-20160816; + b=FM9SQbkYmqWaOAa8YRKsdoj3BSoNN/SsDqXgEaRL8lCygJuahCT1ybocV1IqmUSTxS + l5AcUJGbZbl2BeNhK5mX43aCfKBSSF3DLhmRCMBC8pU2iPmv7TuSV58kRfLY6r83j8Ic + dV56QUYYtN+Ve0BWnaHFOzivSNAgHxwePstQL043LHD2rn+B5CyNvq7l2CahnhMJ8JUG + zJNSBe/LFF0Lhkymqd877vkJ+x+UjSWEIdomIJdAcAt2D06jDxwIF/nnLDDHmvQeny2N + 8xqssE401QcYCq6GtRi0UTAyMrYiDU4RUPOh8Kjb5YoMXYpbI+BCsr6VJlh6/F6cFD58 + YStw== +ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; + s=arc-20160816; + h=sender:errors-to:content-transfer-encoding:cc:reply-to + :list-subscribe:list-help:list-post:list-archive:list-unsubscribe + :list-id:precedence:subject:feedback-id:mime-version:references + :in-reply-to:message-id:date:to:from:delivered-to; + bh=JCKfqtynP85UyN4OG5PQuC2GOM45EC75rPa/TN9Pkis=; + b=MF78hg+0KkjUNq5Bjz6b4rjcJDJqrFufWHhDWzKgWCGo15fvnVg3UY8PDvpsUYxxSA + SXQJP1urvuxLvJ9m6N20/mBCgrN9Cqca537oiWWNbayAOBLuihXPNDPZLqYgD9yg+03U + Qo46rKs8BxkuzTKsqfFu1cf8b3qgqp2wt2mOFFnRU8p9J5foA5HCpHoEB1SWo8KqKjqz + NeFoyh4k/CHk8Qy2rhQ/ahuNo0zByXEVuGqBEK1GakW8bC6DpX/gX9PnsE7BvpOrO/+z + iEJxUd1RyUFDRETjdcqfLeRlEBO0NbFi9GTRjg0oY7m2OM8gh9zw7TIOoKfKaCVepa+1 + zs+g== +ARC-Authentication-Results: i=1; mx.google.com; + spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org + designates 79.124.17.100 as permitted sender) + smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org +Return-Path: +Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) + by mx.google.com with ESMTP id + f21-20020a170906825500b00965c55c71d9si10492876ejx.988.2023.05.15.01.34.19; + Mon, 15 May 2023 01:34:19 -0700 (PDT) +Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org + designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; +Authentication-Results: mx.google.com; + spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org + designates 79.124.17.100 as permitted sender) + smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org +Received: from [127.0.1.1] (localhost [127.0.0.1]) + by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 3486468C072; + Mon, 15 May 2023 11:34:13 +0300 (EEST) +X-Original-To: ffmpeg-devel@ffmpeg.org +Delivered-To: ffmpeg-devel@ffmpeg.org +Received: from bg4.exmail.qq.com (bg4.exmail.qq.com [43.154.221.58]) + by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 6482B68C0A0 + for ; Mon, 15 May 2023 11:34:05 +0300 (EEST) +X-QQ-mid: bizesmtp71t1684139639tsfp6osq +Received: from localhost ( [103.102.203.204]) by bizesmtp.qq.com (ESMTP) with + id ; Mon, 15 May 2023 16:33:58 +0800 (CST) +X-QQ-SSF: 01100000000000Z0Z000000A0000000 +X-QQ-FEAT: v2TBAhtyi5HmOI8RH62YXWVaml0uNXxcsJwtXrqVzXdpJwJpkYcpKS0jOn5b8 + vputCYK1FNClBNOmv9AzELjT/K26cFOsUYKBpAudrf8Al/Kmwl8CjyT6nDK06QByrHu67A4 + sX8VQrazIXO6ZPIrfA9ElusXtssmR22e8ju0nXX7oNy/AS4t0bZkuJRVmYCoHSCnLqnvF9r + YboVdmg0ZbLovrXBy26bgQr944G/tQRTeAGorAwE61Lf9tqlRKuT8TO8/BA/V7zBuaZTSxA + nghl61awPoduY4vd9Nepw43V2Cun4wfPTvAMJn9EQhrdUge4sIN0Q4EuWkBd9dC/nTOwVKV + WsjLxbyL6apFe08XmyeS9MDJkL+bFN3ykpDJqblBg8C1AYOjVyYFS2Yt/atcQ== +X-QQ-GoodBg: 0 +X-BIZMAIL-ID: 14221595051603022987 +From: Steven Liu +To: ffmpeg-devel@ffmpeg.org +Date: Mon, 15 May 2023 16:32:01 +0800 +Message-Id: <20230515083201.48201-7-lq@chinaffmpeg.org> +X-Mailer: git-send-email 2.40.0 +In-Reply-To: <20230515083201.48201-1-lq@chinaffmpeg.org> +References: + + <20230515083201.48201-1-lq@chinaffmpeg.org> +MIME-Version: 1.0 +X-QQ-SENDSIZE: 520 +Feedback-ID: bizesmtp:chinaffmpeg.org:qybglogicsvrsz:qybglogicsvrsz3a-3 +Subject: [FFmpeg-devel] [PATCH v10 6/6] avformat/flvdec: support demux vp9 + in enhanced flv +X-BeenThere: ffmpeg-devel@ffmpeg.org +X-Mailman-Version: 2.1.29 +Precedence: list +List-Id: FFmpeg development discussions and patches +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +Reply-To: FFmpeg development discussions and patches +Cc: Steven Liu +Errors-To: ffmpeg-devel-bounces@ffmpeg.org +Sender: "ffmpeg-devel" +X-TUID: wOtvTzk+zhdw + +Signed-off-by: Steven Liu +--- + libavformat/flvdec.c | 11 +++++++++-- + 1 file changed, 9 insertions(+), 2 deletions(-) + +diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c +index a0362ff11c..a6a94a4021 100644 +--- a/libavformat/flvdec.c ++++ b/libavformat/flvdec.c +@@ -320,6 +320,8 @@ static int flv_same_video_codec(AVFormatContext *s, AVCodecParameters *vpar, int + return vpar->codec_id == AV_CODEC_ID_HEVC; + case MKBETAG('a', 'v', '0', '1'): + return vpar->codec_id == AV_CODEC_ID_AV1; ++ case MKBETAG('v', 'p', '0', '9'): ++ return vpar->codec_id == AV_CODEC_ID_VP9; + default: + break; + } +@@ -365,6 +367,10 @@ static int flv_set_video_codec(AVFormatContext *s, AVStream *vstream, + par->codec_id = AV_CODEC_ID_AV1; + vstreami->need_parsing = AVSTREAM_PARSE_HEADERS; + return 4; ++ case MKBETAG('v', 'p', '0', '9'): ++ par->codec_id = AV_CODEC_ID_VP9; ++ vstreami->need_parsing = AVSTREAM_PARSE_HEADERS; ++ return 4; + default: + break; + } +@@ -1285,7 +1291,8 @@ retry_duration: + st->codecpar->codec_id == AV_CODEC_ID_H264 || + st->codecpar->codec_id == AV_CODEC_ID_MPEG4 || + st->codecpar->codec_id == AV_CODEC_ID_HEVC || +- st->codecpar->codec_id == AV_CODEC_ID_AV1) { ++ st->codecpar->codec_id == AV_CODEC_ID_AV1 || ++ st->codecpar->codec_id == AV_CODEC_ID_VP9) { + int type = 0; + if (flv->exheader && stream_type == FLV_STREAM_TYPE_VIDEO) { + type = flags & 0x0F; +@@ -1317,7 +1324,7 @@ retry_duration: + } + if (type == 0 && (!st->codecpar->extradata || st->codecpar->codec_id == AV_CODEC_ID_AAC || + st->codecpar->codec_id == AV_CODEC_ID_H264 || st->codecpar->codec_id == AV_CODEC_ID_HEVC || +- st->codecpar->codec_id == AV_CODEC_ID_AV1)) { ++ st->codecpar->codec_id == AV_CODEC_ID_AV1 || st->codecpar->codec_id == AV_CODEC_ID_VP9)) { + AVDictionaryEntry *t; + + if (st->codecpar->extradata) { diff --git a/enable_decoders b/enable_decoders index 296c3a3..ea1c38e 100644 --- a/enable_decoders +++ b/enable_decoders @@ -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 diff --git a/enable_encoders b/enable_encoders index e0f3cfb..10dd53a 100644 --- a/enable_encoders +++ b/enable_encoders @@ -30,6 +30,7 @@ asv2 av1_amf av1_nvenc av1_qsv +av1_vaapi ayuv # trival bitpacked # trivial bmp # trivial diff --git a/ffmpeg-ge-av1-vaapi-encode-support.patch b/ffmpeg-ge-av1-vaapi-encode-support.patch new file mode 100644 index 0000000..6ae8258 --- /dev/null +++ b/ffmpeg-ge-av1-vaapi-encode-support.patch @@ -0,0 +1,3984 @@ +From 7c2ea45053b7a3d4193bb0abb9c0f3b0cdbeec7a Mon Sep 17 00:00:00 2001 +From: GloriousEggroll +Date: Thu, 9 Nov 2023 17:51:19 -0700 +Subject: [PATCH] backport av1 encode support + +Adapted from https://patchwork.ffmpeg.org/project/ffmpeg/list/?series=9594 + +--- + configure | 3 + + doc/encoders.texi | 14 + + libavcodec/Makefile | 2 + + libavcodec/allcodecs.c | 1 + + libavcodec/av1.h | 7 + + libavcodec/av1_levels.c | 92 +++ + libavcodec/av1_levels.h | 58 ++ + libavcodec/cbs.c | 155 +++-- + libavcodec/cbs.h | 88 ++- + libavcodec/cbs_av1.c | 262 +++----- + libavcodec/cbs_av1.h | 1 + + libavcodec/cbs_av1_syntax_template.c | 4 +- + libavcodec/cbs_bsf.c | 5 + + libavcodec/cbs_h2645.c | 149 ++--- + libavcodec/cbs_internal.h | 96 ++- + libavcodec/cbs_mpeg2.c | 15 +- + libavcodec/cbs_vp9.c | 122 ++-- + libavcodec/extract_extradata_bsf.c | 7 +- + libavcodec/trace_headers_bsf.c | 2 + + libavcodec/vaapi_encode.c | 370 ++++++++--- + libavcodec/vaapi_encode.h | 39 +- + libavcodec/vaapi_encode_av1.c | 949 +++++++++++++++++++++++++++ + libavcodec/vaapi_encode_h264.c | 94 +-- + libavcodec/vaapi_encode_h265.c | 76 ++- + libavcodec/vaapi_encode_mpeg2.c | 6 +- + libavcodec/vaapi_encode_vp8.c | 6 +- + libavcodec/vaapi_encode_vp9.c | 26 +- + 27 files changed, 2054 insertions(+), 595 deletions(-) + create mode 100644 libavcodec/av1_levels.c + create mode 100644 libavcodec/av1_levels.h + create mode 100644 libavcodec/vaapi_encode_av1.c + +diff --git a/configure b/configure +index b6616f0..f5a91b6 100755 +--- a/configure ++++ b/configure +@@ -3259,6 +3259,8 @@ av1_qsv_decoder_select="qsvdec" + av1_qsv_encoder_select="qsvenc" + av1_qsv_encoder_deps="libvpl" + av1_amf_encoder_deps="amf" ++av1_vaapi_encoder_deps="VAEncPictureParameterBufferAV1" ++av1_vaapi_encoder_select="cbs_av1 vaapi_encode" + + # parsers + aac_parser_select="adts_header mpeg4audio" +@@ -6973,6 +6975,7 @@ if enabled vaapi; then + check_type "va/va.h va/va_enc_jpeg.h" "VAEncPictureParameterBufferJPEG" + check_type "va/va.h va/va_enc_vp8.h" "VAEncPictureParameterBufferVP8" + check_type "va/va.h va/va_enc_vp9.h" "VAEncPictureParameterBufferVP9" ++ check_type "va/va.h va/va_enc_av1.h" "VAEncPictureParameterBufferAV1" + fi + + if enabled_all opencl libdrm ; then +diff --git a/doc/encoders.texi b/doc/encoders.texi +index b02737b..994e27f 100644 +--- a/doc/encoders.texi ++++ b/doc/encoders.texi +@@ -3965,6 +3965,20 @@ Average variable bitrate. + Each encoder also has its own specific options: + @table @option + ++@item av1_vaapi ++@option{profile} sets the value of @emph{seq_profile}. ++@option{tier} sets the value of @emph{seq_tier}. ++@option{level} sets the value of @emph{seq_level_idx}. ++ ++@table @option ++@item tiles ++Set the number of tiles to encode the input video with, as columns x rows. ++(default is auto, which means use minimal tile column/row number). ++@item tile_groups ++Set tile groups number. All the tiles will be distributed as evenly as possible to ++each tile group. (default is 1). ++@end table ++ + @item h264_vaapi + @option{profile} sets the value of @emph{profile_idc} and the @emph{constraint_set*_flag}s. + @option{level} sets the value of @emph{level_idc}. +diff --git a/libavcodec/Makefile b/libavcodec/Makefile +index 389253f..5f620e6 100644 +--- a/libavcodec/Makefile ++++ b/libavcodec/Makefile +@@ -255,6 +255,7 @@ OBJS-$(CONFIG_AV1_CUVID_DECODER) += cuviddec.o + OBJS-$(CONFIG_AV1_MEDIACODEC_DECODER) += mediacodecdec.o + OBJS-$(CONFIG_AV1_NVENC_ENCODER) += nvenc_av1.o nvenc.o + OBJS-$(CONFIG_AV1_QSV_ENCODER) += qsvenc_av1.o ++OBJS-$(CONFIG_AV1_VAAPI_ENCODER) += vaapi_encode_av1.o av1_levels.o + OBJS-$(CONFIG_AVRN_DECODER) += avrndec.o + OBJS-$(CONFIG_AVRP_DECODER) += r210dec.o + OBJS-$(CONFIG_AVRP_ENCODER) += r210enc.o +@@ -1298,6 +1299,7 @@ TESTPROGS = avcodec \ + jpeg2000dwt \ + mathops \ + ++TESTPROGS-$(CONFIG_AV1_VAAPI_ENCODER) += av1_levels + TESTPROGS-$(CONFIG_CABAC) += cabac + TESTPROGS-$(CONFIG_DCT) += avfft + TESTPROGS-$(CONFIG_FFT) += fft fft-fixed32 +diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c +index e593ad1..4706fc3 100644 +--- a/libavcodec/allcodecs.c ++++ b/libavcodec/allcodecs.c +@@ -838,6 +838,7 @@ extern const FFCodec ff_av1_nvenc_encoder; + extern const FFCodec ff_av1_qsv_decoder; + extern const FFCodec ff_av1_qsv_encoder; + extern const FFCodec ff_av1_amf_encoder; ++extern const FFCodec ff_av1_vaapi_encoder; + extern const FFCodec ff_libopenh264_encoder; + extern const FFCodec ff_libopenh264_decoder; + extern const FFCodec ff_h264_amf_encoder; +diff --git a/libavcodec/av1.h b/libavcodec/av1.h +index 384f7cd..8704bc4 100644 +--- a/libavcodec/av1.h ++++ b/libavcodec/av1.h +@@ -175,6 +175,13 @@ enum { + AV1_RESTORE_SWITCHABLE = 3, + }; + ++// TX mode (section 6.8.21) ++enum { ++ AV1_ONLY_4X4 = 0, ++ AV1_TX_MODE_LARGEST = 1, ++ AV1_TX_MODE_SELECT = 2, ++}; ++ + // Sequence Headers are actually unbounded because one can use + // an arbitrary number of leading zeroes when encoding via uvlc. + // The following estimate is based around using the lowest number +diff --git a/libavcodec/av1_levels.c b/libavcodec/av1_levels.c +new file mode 100644 +index 0000000..19b6ee1 +--- /dev/null ++++ b/libavcodec/av1_levels.c +@@ -0,0 +1,92 @@ ++/* ++ * Copyright (c) 2023 Intel Corporation ++ * ++ * This file is part of FFmpeg. ++ * ++ * FFmpeg is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * FFmpeg is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with FFmpeg; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ */ ++ ++#include ++#include "libavutil/macros.h" ++#include "av1_levels.h" ++ ++/** ignore entries which named in spec but no details. Like level 2.2 and 7.0. */ ++static const AV1LevelDescriptor av1_levels[] = { ++ // Name MaxVSize MainMbps MaxTiles ++ // | level_idx | MaxDisplayRate | HighMbps | MaxTileCols ++ // | | MaxPicSize | | MaxDecodeRate | | MainCR | | ++ // | | | MaxHSize | | | MaxHeaderRate | | | HighCR| | ++ // | | | | | | | | | | | | | | ++ { "2.0", 0, 147456, 2048, 1152, 4423680, 5529600, 150, 1.5, 0, 2, 0, 8, 4 }, ++ { "2.1", 1, 278784, 2816, 1584, 8363520, 10454400, 150, 3.0, 0, 2, 0, 8, 4 }, ++ { "3.0", 4, 665856, 4352, 2448, 19975680, 24969600, 150, 6.0, 0, 2, 0, 16, 6 }, ++ { "3.1", 5, 1065024, 5504, 3096, 31950720, 39938400, 150, 10.0, 0, 2, 0, 16, 6 }, ++ { "4.0", 8, 2359296, 6144, 3456, 70778880, 77856768, 300, 12.0, 30.0, 4, 4, 32, 8 }, ++ { "4.1", 9, 2359296, 6144, 3456, 141557760, 155713536, 300, 20.0, 50.0, 4, 4, 32, 8 }, ++ { "5.0", 12, 8912896, 8192, 4352, 267386880, 273715200, 300, 30.0, 100.0, 6, 4, 64, 8 }, ++ { "5.1", 13, 8912896, 8192, 4352, 534773760, 547430400, 300, 40.0, 160.0, 8, 4, 64, 8 }, ++ { "5.2", 14, 8912896, 8192, 4352, 1069547520, 1094860800, 300, 60.0, 240.0, 8, 4, 64, 8 }, ++ { "5.3", 15, 8912896, 8192, 4352, 1069547520, 1176502272, 300, 60.0, 240.0, 8, 4, 64, 8 }, ++ { "6.0", 16, 35651584, 16384, 8704, 1069547520, 1176502272, 300, 60.0, 240.0, 8, 4, 128, 16 }, ++ { "6.1", 17, 35651584, 16384, 8704, 2139095040, 2189721600, 300, 100.0, 480.0, 8, 4, 128, 16 }, ++ { "6.2", 18, 35651584, 16384, 8704, 4278190080, 4379443200, 300, 160.0, 800.0, 8, 4, 128, 16 }, ++ { "6.3", 19, 35651584, 16384, 8704, 4278190080, 4706009088, 300, 160.0, 800.0, 8, 4, 128, 16 }, ++}; ++ ++const AV1LevelDescriptor *ff_av1_guess_level(int64_t bitrate, ++ int tier, ++ int width, ++ int height, ++ int tiles, ++ int tile_cols, ++ float fps) ++{ ++ int pic_size; ++ uint64_t display_rate; ++ float max_br; ++ ++ pic_size = width * height; ++ display_rate = (uint64_t)pic_size * fps; ++ ++ for (int i = 0; i < FF_ARRAY_ELEMS(av1_levels); i++) { ++ const AV1LevelDescriptor *level = &av1_levels[i]; ++ // Limitation: decode rate, header rate, compress rate, etc. are not considered. ++ if (pic_size > level->max_pic_size) ++ continue; ++ if (width > level->max_h_size) ++ continue; ++ if (height > level->max_v_size) ++ continue; ++ if (display_rate > level->max_display_rate) ++ continue; ++ ++ if (tier) ++ max_br = level->high_mbps; ++ else ++ max_br = level->main_mbps; ++ if (!max_br) ++ continue; ++ if (bitrate > (int64_t)(1000000.0 * max_br)) ++ continue; ++ ++ if (tiles > level->max_tiles) ++ continue; ++ if (tile_cols > level->max_tile_cols) ++ continue; ++ return level; ++ } ++ ++ return NULL; ++} +diff --git a/libavcodec/av1_levels.h b/libavcodec/av1_levels.h +new file mode 100644 +index 0000000..164cb87 +--- /dev/null ++++ b/libavcodec/av1_levels.h +@@ -0,0 +1,58 @@ ++/* ++ * Copyright (c) 2023 Intel Corporation ++ * ++ * This file is part of FFmpeg. ++ * ++ * FFmpeg is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * FFmpeg is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with FFmpeg; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ */ ++ ++#ifndef AVCODEC_AV1_LEVELS_H ++#define AVCODEC_AV1_LEVELS_H ++ ++#include ++ ++typedef struct AV1LevelDescriptor { ++ char name[4]; ++ uint8_t level_idx; ++ ++ uint32_t max_pic_size; ++ uint32_t max_h_size; ++ uint32_t max_v_size; ++ uint64_t max_display_rate; ++ uint64_t max_decode_rate; ++ ++ uint32_t max_header_rate; ++ float main_mbps; ++ float high_mbps; ++ uint32_t main_cr; ++ uint32_t high_cr; ++ uint32_t max_tiles; ++ uint32_t max_tile_cols; ++} AV1LevelDescriptor; ++ ++/** ++ * Guess the level of a stream from some parameters. ++ * ++ * Unknown parameters may be zero, in which case they will be ignored. ++ */ ++const AV1LevelDescriptor *ff_av1_guess_level(int64_t bitrate, ++ int tier, ++ int width, ++ int height, ++ int tile_rows, ++ int tile_cols, ++ float fps); ++ ++#endif /* AVCODEC_AV1_LEVELS_H */ +diff --git a/libavcodec/cbs.c b/libavcodec/cbs.c +index 504197e..64b9aee 100644 +--- a/libavcodec/cbs.c ++++ b/libavcodec/cbs.c +@@ -111,8 +111,9 @@ av_cold int ff_cbs_init(CodedBitstreamContext **ctx_ptr, + + ctx->decompose_unit_types = NULL; + +- ctx->trace_enable = 0; +- ctx->trace_level = AV_LOG_TRACE; ++ ctx->trace_enable = 0; ++ ctx->trace_level = AV_LOG_TRACE; ++ ctx->trace_context = ctx; + + *ctx_ptr = ctx; + return 0; +@@ -490,19 +491,27 @@ void ff_cbs_trace_header(CodedBitstreamContext *ctx, + av_log(ctx->log_ctx, ctx->trace_level, "%s\n", name); + } + +-void ff_cbs_trace_syntax_element(CodedBitstreamContext *ctx, int position, +- const char *str, const int *subscripts, +- const char *bits, int64_t value) ++void ff_cbs_trace_read_log(void *trace_context, ++ GetBitContext *gbc, int length, ++ const char *str, const int *subscripts, ++ int64_t value) + { ++ CodedBitstreamContext *ctx = trace_context; + char name[256]; ++ char bits[256]; + size_t name_len, bits_len; + int pad, subs, i, j, k, n; +- +- if (!ctx->trace_enable) +- return; ++ int position; + + av_assert0(value >= INT_MIN && value <= UINT32_MAX); + ++ position = get_bits_count(gbc); ++ ++ av_assert0(length < 256); ++ for (i = 0; i < length; i++) ++ bits[i] = get_bits1(gbc) ? '1' : '0'; ++ bits[length] = 0; ++ + subs = subscripts ? subscripts[0] : 0; + n = 0; + for (i = j = 0; str[i];) { +@@ -529,7 +538,7 @@ void ff_cbs_trace_syntax_element(CodedBitstreamContext *ctx, int position, + av_assert0(n == subs); + + name_len = strlen(name); +- bits_len = strlen(bits); ++ bits_len = length; + + if (name_len + bits_len > 60) + pad = bits_len + 2; +@@ -540,14 +549,48 @@ void ff_cbs_trace_syntax_element(CodedBitstreamContext *ctx, int position, + position, name, pad, bits, value); + } + +-int ff_cbs_read_unsigned(CodedBitstreamContext *ctx, GetBitContext *gbc, +- int width, const char *name, +- const int *subscripts, uint32_t *write_to, +- uint32_t range_min, uint32_t range_max) ++void ff_cbs_trace_write_log(void *trace_context, ++ PutBitContext *pbc, int length, ++ const char *str, const int *subscripts, ++ int64_t value) + { +- uint32_t value; ++ CodedBitstreamContext *ctx = trace_context; ++ ++ // Ensure that the syntax element is written to the output buffer, ++ // make a GetBitContext pointed at the start position, then call the ++ // read log function which can read the bits back to log them. ++ ++ GetBitContext gbc; + int position; + ++ if (length > 0) { ++ PutBitContext flush; ++ flush = *pbc; ++ flush_put_bits(&flush); ++ } ++ ++ position = put_bits_count(pbc); ++ av_assert0(position >= length); ++ ++ init_get_bits(&gbc, pbc->buf, position); ++ ++ skip_bits_long(&gbc, position - length); ++ ++ ff_cbs_trace_read_log(ctx, &gbc, length, str, subscripts, value); ++} ++ ++static av_always_inline int cbs_read_unsigned(CodedBitstreamContext *ctx, ++ GetBitContext *gbc, ++ int width, const char *name, ++ const int *subscripts, ++ uint32_t *write_to, ++ uint32_t range_min, ++ uint32_t range_max) ++{ ++ uint32_t value; ++ ++ CBS_TRACE_READ_START(); ++ + av_assert0(width > 0 && width <= 32); + + if (get_bits_left(gbc) < width) { +@@ -556,21 +599,9 @@ int ff_cbs_read_unsigned(CodedBitstreamContext *ctx, GetBitContext *gbc, + return AVERROR_INVALIDDATA; + } + +- if (ctx->trace_enable) +- position = get_bits_count(gbc); +- + value = get_bits_long(gbc, width); + +- if (ctx->trace_enable) { +- char bits[33]; +- int i; +- for (i = 0; i < width; i++) +- bits[i] = value >> (width - i - 1) & 1 ? '1' : '0'; +- bits[i] = 0; +- +- ff_cbs_trace_syntax_element(ctx, position, name, subscripts, +- bits, value); +- } ++ CBS_TRACE_READ_END(); + + if (value < range_min || value > range_max) { + av_log(ctx->log_ctx, AV_LOG_ERROR, "%s out of range: " +@@ -583,11 +614,29 @@ int ff_cbs_read_unsigned(CodedBitstreamContext *ctx, GetBitContext *gbc, + return 0; + } + ++int ff_cbs_read_unsigned(CodedBitstreamContext *ctx, GetBitContext *gbc, ++ int width, const char *name, ++ const int *subscripts, uint32_t *write_to, ++ uint32_t range_min, uint32_t range_max) ++{ ++ return cbs_read_unsigned(ctx, gbc, width, name, subscripts, ++ write_to, range_min, range_max); ++} ++ ++int ff_cbs_read_simple_unsigned(CodedBitstreamContext *ctx, GetBitContext *gbc, ++ int width, const char *name, uint32_t *write_to) ++{ ++ return cbs_read_unsigned(ctx, gbc, width, name, NULL, ++ write_to, 0, UINT32_MAX); ++} ++ + int ff_cbs_write_unsigned(CodedBitstreamContext *ctx, PutBitContext *pbc, + int width, const char *name, + const int *subscripts, uint32_t value, + uint32_t range_min, uint32_t range_max) + { ++ CBS_TRACE_WRITE_START(); ++ + av_assert0(width > 0 && width <= 32); + + if (value < range_min || value > range_max) { +@@ -600,32 +649,31 @@ int ff_cbs_write_unsigned(CodedBitstreamContext *ctx, PutBitContext *pbc, + if (put_bits_left(pbc) < width) + return AVERROR(ENOSPC); + +- if (ctx->trace_enable) { +- char bits[33]; +- int i; +- for (i = 0; i < width; i++) +- bits[i] = value >> (width - i - 1) & 1 ? '1' : '0'; +- bits[i] = 0; +- +- ff_cbs_trace_syntax_element(ctx, put_bits_count(pbc), +- name, subscripts, bits, value); +- } +- + if (width < 32) + put_bits(pbc, width, value); + else + put_bits32(pbc, value); + ++ CBS_TRACE_WRITE_END(); ++ + return 0; + } + ++int ff_cbs_write_simple_unsigned(CodedBitstreamContext *ctx, PutBitContext *pbc, ++ int width, const char *name, uint32_t value) ++{ ++ return ff_cbs_write_unsigned(ctx, pbc, width, name, NULL, ++ value, 0, MAX_UINT_BITS(width)); ++} ++ + int ff_cbs_read_signed(CodedBitstreamContext *ctx, GetBitContext *gbc, + int width, const char *name, + const int *subscripts, int32_t *write_to, + int32_t range_min, int32_t range_max) + { + int32_t value; +- int position; ++ ++ CBS_TRACE_READ_START(); + + av_assert0(width > 0 && width <= 32); + +@@ -635,21 +683,9 @@ int ff_cbs_read_signed(CodedBitstreamContext *ctx, GetBitContext *gbc, + return AVERROR_INVALIDDATA; + } + +- if (ctx->trace_enable) +- position = get_bits_count(gbc); +- + value = get_sbits_long(gbc, width); + +- if (ctx->trace_enable) { +- char bits[33]; +- int i; +- for (i = 0; i < width; i++) +- bits[i] = value & (1U << (width - i - 1)) ? '1' : '0'; +- bits[i] = 0; +- +- ff_cbs_trace_syntax_element(ctx, position, name, subscripts, +- bits, value); +- } ++ CBS_TRACE_READ_END(); + + if (value < range_min || value > range_max) { + av_log(ctx->log_ctx, AV_LOG_ERROR, "%s out of range: " +@@ -667,6 +703,8 @@ int ff_cbs_write_signed(CodedBitstreamContext *ctx, PutBitContext *pbc, + const int *subscripts, int32_t value, + int32_t range_min, int32_t range_max) + { ++ CBS_TRACE_WRITE_START(); ++ + av_assert0(width > 0 && width <= 32); + + if (value < range_min || value > range_max) { +@@ -679,22 +717,13 @@ int ff_cbs_write_signed(CodedBitstreamContext *ctx, PutBitContext *pbc, + if (put_bits_left(pbc) < width) + return AVERROR(ENOSPC); + +- if (ctx->trace_enable) { +- char bits[33]; +- int i; +- for (i = 0; i < width; i++) +- bits[i] = value & (1U << (width - i - 1)) ? '1' : '0'; +- bits[i] = 0; +- +- ff_cbs_trace_syntax_element(ctx, put_bits_count(pbc), +- name, subscripts, bits, value); +- } +- + if (width < 32) + put_sbits(pbc, width, value); + else + put_bits32(pbc, value); + ++ CBS_TRACE_WRITE_END(); ++ + return 0; + } + +diff --git a/libavcodec/cbs.h b/libavcodec/cbs.h +index ee21623..f6509a2 100644 +--- a/libavcodec/cbs.h ++++ b/libavcodec/cbs.h +@@ -167,6 +167,51 @@ typedef struct CodedBitstreamFragment { + CodedBitstreamUnit *units; + } CodedBitstreamFragment; + ++ ++struct CodedBitstreamContext; ++struct GetBitContext; ++struct PutBitContext; ++ ++/** ++ * Callback type for read tracing. ++ * ++ * @param ctx User-set trace context. ++ * @param gbc A GetBitContext set at the start of the syntax ++ * element. This is a copy, the callee does not ++ * need to preserve it. ++ * @param length Length in bits of the syntax element. ++ * @param name String name of the syntax elements. ++ * @param subscripts If the syntax element is an array, a pointer to ++ * an array of subscripts into the array. ++ * @param value Parsed value of the syntax element. ++ */ ++typedef void (*CBSTraceReadCallback)(void *trace_context, ++ struct GetBitContext *gbc, ++ int start_position, ++ const char *name, ++ const int *subscripts, ++ int64_t value); ++ ++/** ++ * Callback type for write tracing. ++ * ++ * @param ctx User-set trace context. ++ * @param pbc A PutBitContext set at the end of the syntax ++ * element. The user must not modify this, but may ++ * inspect it to determine state. ++ * @param length Length in bits of the syntax element. ++ * @param name String name of the syntax elements. ++ * @param subscripts If the syntax element is an array, a pointer to ++ * an array of subscripts into the array. ++ * @param value Written value of the syntax element. ++ */ ++typedef void (*CBSTraceWriteCallback)(void *trace_context, ++ struct PutBitContext *pbc, ++ int start_position, ++ const char *name, ++ const int *subscripts, ++ int64_t value); ++ + /** + * Context structure for coded bitstream operations. + */ +@@ -210,11 +255,29 @@ typedef struct CodedBitstreamContext { + */ + int trace_enable; + /** +- * Log level to use for trace output. ++ * Log level to use for default trace output. + * + * From AV_LOG_*; defaults to AV_LOG_TRACE. + */ + int trace_level; ++ /** ++ * User context pointer to pass to trace callbacks. ++ */ ++ void *trace_context; ++ /** ++ * Callback for read tracing. ++ * ++ * If tracing is enabled then this is called once for each syntax ++ * element parsed. ++ */ ++ CBSTraceReadCallback trace_read_callback; ++ /** ++ * Callback for write tracing. ++ * ++ * If tracing is enabled then this is called once for each syntax ++ * element written. ++ */ ++ CBSTraceWriteCallback trace_write_callback; + + /** + * Write buffer. Used as intermediate buffer when writing units. +@@ -433,4 +496,27 @@ int ff_cbs_make_unit_writable(CodedBitstreamContext *ctx, + CodedBitstreamUnit *unit); + + ++ ++/** ++ * Helper function for read tracing which formats the syntax element ++ * and logs the result. ++ * ++ * Trace context should be set to the CodedBitstreamContext. ++ */ ++void ff_cbs_trace_read_log(void *trace_context, ++ struct GetBitContext *gbc, int length, ++ const char *str, const int *subscripts, ++ int64_t value); ++ ++/** ++ * Helper function for write tracing which formats the syntax element ++ * and logs the result. ++ * ++ * Trace context should be set to the CodedBitstreamContext. ++ */ ++void ff_cbs_trace_write_log(void *trace_context, ++ struct PutBitContext *pbc, int length, ++ const char *str, const int *subscripts, ++ int64_t value); ++ + #endif /* AVCODEC_CBS_H */ +diff --git a/libavcodec/cbs_av1.c b/libavcodec/cbs_av1.c +index 45e1288..6098c97 100644 +--- a/libavcodec/cbs_av1.c ++++ b/libavcodec/cbs_av1.c +@@ -31,10 +31,8 @@ static int cbs_av1_read_uvlc(CodedBitstreamContext *ctx, GetBitContext *gbc, + uint32_t range_min, uint32_t range_max) + { + uint32_t zeroes, bits_value, value; +- int position; + +- if (ctx->trace_enable) +- position = get_bits_count(gbc); ++ CBS_TRACE_READ_START(); + + zeroes = 0; + while (1) { +@@ -50,6 +48,9 @@ static int cbs_av1_read_uvlc(CodedBitstreamContext *ctx, GetBitContext *gbc, + } + + if (zeroes >= 32) { ++ // Note that the spec allows an arbitrarily large number of ++ // zero bits followed by a one bit in this case, but the ++ // libaom implementation does not support it. + value = MAX_UINT_BITS(32); + } else { + if (get_bits_left(gbc) < zeroes) { +@@ -62,36 +63,7 @@ static int cbs_av1_read_uvlc(CodedBitstreamContext *ctx, GetBitContext *gbc, + value = bits_value + (UINT32_C(1) << zeroes) - 1; + } + +- if (ctx->trace_enable) { +- char bits[65]; +- int i, j, k; +- +- if (zeroes >= 32) { +- while (zeroes > 32) { +- k = FFMIN(zeroes - 32, 32); +- for (i = 0; i < k; i++) +- bits[i] = '0'; +- bits[i] = 0; +- ff_cbs_trace_syntax_element(ctx, position, name, +- NULL, bits, 0); +- zeroes -= k; +- position += k; +- } +- } +- +- for (i = 0; i < zeroes; i++) +- bits[i] = '0'; +- bits[i++] = '1'; +- +- if (zeroes < 32) { +- for (j = 0; j < zeroes; j++) +- bits[i++] = (bits_value >> (zeroes - j - 1) & 1) ? '1' : '0'; +- } +- +- bits[i] = 0; +- ff_cbs_trace_syntax_element(ctx, position, name, +- NULL, bits, value); +- } ++ CBS_TRACE_READ_END_NO_SUBSCRIPTS(); + + if (value < range_min || value > range_max) { + av_log(ctx->log_ctx, AV_LOG_ERROR, "%s out of range: " +@@ -109,7 +81,9 @@ static int cbs_av1_write_uvlc(CodedBitstreamContext *ctx, PutBitContext *pbc, + uint32_t range_min, uint32_t range_max) + { + uint32_t v; +- int position, zeroes; ++ int zeroes; ++ ++ CBS_TRACE_WRITE_START(); + + if (value < range_min || value > range_max) { + av_log(ctx->log_ctx, AV_LOG_ERROR, "%s out of range: " +@@ -118,28 +92,17 @@ static int cbs_av1_write_uvlc(CodedBitstreamContext *ctx, PutBitContext *pbc, + return AVERROR_INVALIDDATA; + } + +- if (ctx->trace_enable) +- position = put_bits_count(pbc); +- + zeroes = av_log2(value + 1); + v = value - (1U << zeroes) + 1; ++ ++ if (put_bits_left(pbc) < 2 * zeroes + 1) ++ return AVERROR(ENOSPC); ++ + put_bits(pbc, zeroes, 0); + put_bits(pbc, 1, 1); + put_bits(pbc, zeroes, v); + +- if (ctx->trace_enable) { +- char bits[65]; +- int i, j; +- i = 0; +- for (j = 0; j < zeroes; j++) +- bits[i++] = '0'; +- bits[i++] = '1'; +- for (j = 0; j < zeroes; j++) +- bits[i++] = (v >> (zeroes - j - 1) & 1) ? '1' : '0'; +- bits[i++] = 0; +- ff_cbs_trace_syntax_element(ctx, position, name, NULL, +- bits, value); +- } ++ CBS_TRACE_WRITE_END_NO_SUBSCRIPTS(); + + return 0; + } +@@ -148,20 +111,19 @@ static int cbs_av1_read_leb128(CodedBitstreamContext *ctx, GetBitContext *gbc, + const char *name, uint64_t *write_to) + { + uint64_t value; +- int position, err, i; ++ uint32_t byte; ++ int i; + +- if (ctx->trace_enable) +- position = get_bits_count(gbc); ++ CBS_TRACE_READ_START(); + + value = 0; + for (i = 0; i < 8; i++) { +- int subscript[2] = { 1, i }; +- uint32_t byte; +- err = ff_cbs_read_unsigned(ctx, gbc, 8, "leb128_byte[i]", subscript, +- &byte, 0x00, 0xff); +- if (err < 0) +- return err; +- ++ if (get_bits_left(gbc) < 8) { ++ av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid leb128 at " ++ "%s: bitstream ended.\n", name); ++ return AVERROR_INVALIDDATA; ++ } ++ byte = get_bits(gbc, 8); + value |= (uint64_t)(byte & 0x7f) << (i * 7); + if (!(byte & 0x80)) + break; +@@ -170,39 +132,38 @@ static int cbs_av1_read_leb128(CodedBitstreamContext *ctx, GetBitContext *gbc, + if (value > UINT32_MAX) + return AVERROR_INVALIDDATA; + +- if (ctx->trace_enable) +- ff_cbs_trace_syntax_element(ctx, position, name, NULL, "", value); ++ CBS_TRACE_READ_END_NO_SUBSCRIPTS(); + + *write_to = value; + return 0; + } + ++/** Minimum byte length will be used to indicate the len128 of value if byte_len is 0. */ + static int cbs_av1_write_leb128(CodedBitstreamContext *ctx, PutBitContext *pbc, +- const char *name, uint64_t value) ++ const char *name, uint64_t value, uint8_t byte_len) + { +- int position, err, len, i; ++ int len, i; + uint8_t byte; + +- len = (av_log2(value) + 7) / 7; ++ CBS_TRACE_WRITE_START(); ++ ++ if (byte_len) ++ av_assert0(byte_len >= (av_log2(value) + 7) / 7); + +- if (ctx->trace_enable) +- position = put_bits_count(pbc); ++ len = byte_len ? byte_len : (av_log2(value) + 7) / 7; + + for (i = 0; i < len; i++) { +- int subscript[2] = { 1, i }; ++ if (put_bits_left(pbc) < 8) ++ return AVERROR(ENOSPC); + + byte = value >> (7 * i) & 0x7f; + if (i < len - 1) + byte |= 0x80; + +- err = ff_cbs_write_unsigned(ctx, pbc, 8, "leb128_byte[i]", subscript, +- byte, 0x00, 0xff); +- if (err < 0) +- return err; ++ put_bits(pbc, 8, byte); + } + +- if (ctx->trace_enable) +- ff_cbs_trace_syntax_element(ctx, position, name, NULL, "", value); ++ CBS_TRACE_WRITE_END_NO_SUBSCRIPTS(); + + return 0; + } +@@ -212,12 +173,11 @@ static int cbs_av1_read_ns(CodedBitstreamContext *ctx, GetBitContext *gbc, + const int *subscripts, uint32_t *write_to) + { + uint32_t m, v, extra_bit, value; +- int position, w; ++ int w; + +- av_assert0(n > 0); ++ CBS_TRACE_READ_START(); + +- if (ctx->trace_enable) +- position = get_bits_count(gbc); ++ av_assert0(n > 0); + + w = av_log2(n) + 1; + m = (1 << w) - n; +@@ -240,18 +200,7 @@ static int cbs_av1_read_ns(CodedBitstreamContext *ctx, GetBitContext *gbc, + value = (v << 1) - m + extra_bit; + } + +- if (ctx->trace_enable) { +- char bits[33]; +- int i; +- for (i = 0; i < w - 1; i++) +- bits[i] = (v >> i & 1) ? '1' : '0'; +- if (v >= m) +- bits[i++] = extra_bit ? '1' : '0'; +- bits[i] = 0; +- +- ff_cbs_trace_syntax_element(ctx, position, +- name, subscripts, bits, value); +- } ++ CBS_TRACE_READ_END(); + + *write_to = value; + return 0; +@@ -262,7 +211,8 @@ static int cbs_av1_write_ns(CodedBitstreamContext *ctx, PutBitContext *pbc, + const int *subscripts, uint32_t value) + { + uint32_t w, m, v, extra_bit; +- int position; ++ ++ CBS_TRACE_WRITE_START(); + + if (value > n) { + av_log(ctx->log_ctx, AV_LOG_ERROR, "%s out of range: " +@@ -271,9 +221,6 @@ static int cbs_av1_write_ns(CodedBitstreamContext *ctx, PutBitContext *pbc, + return AVERROR_INVALIDDATA; + } + +- if (ctx->trace_enable) +- position = put_bits_count(pbc); +- + w = av_log2(n) + 1; + m = (1 << w) - n; + +@@ -290,18 +237,7 @@ static int cbs_av1_write_ns(CodedBitstreamContext *ctx, PutBitContext *pbc, + put_bits(pbc, 1, extra_bit); + } + +- if (ctx->trace_enable) { +- char bits[33]; +- int i; +- for (i = 0; i < w - 1; i++) +- bits[i] = (v >> i & 1) ? '1' : '0'; +- if (value >= m) +- bits[i++] = extra_bit ? '1' : '0'; +- bits[i] = 0; +- +- ff_cbs_trace_syntax_element(ctx, position, +- name, subscripts, bits, value); +- } ++ CBS_TRACE_WRITE_END(); + + return 0; + } +@@ -311,33 +247,24 @@ static int cbs_av1_read_increment(CodedBitstreamContext *ctx, GetBitContext *gbc + const char *name, uint32_t *write_to) + { + uint32_t value; +- int position, i; +- char bits[33]; + +- av_assert0(range_min <= range_max && range_max - range_min < sizeof(bits) - 1); +- if (ctx->trace_enable) +- position = get_bits_count(gbc); ++ CBS_TRACE_READ_START(); ++ ++ av_assert0(range_min <= range_max && range_max - range_min < 32); + +- for (i = 0, value = range_min; value < range_max;) { ++ for (value = range_min; value < range_max;) { + if (get_bits_left(gbc) < 1) { + av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid increment value at " + "%s: bitstream ended.\n", name); + return AVERROR_INVALIDDATA; + } +- if (get_bits1(gbc)) { +- bits[i++] = '1'; ++ if (get_bits1(gbc)) + ++value; +- } else { +- bits[i++] = '0'; ++ else + break; +- } + } + +- if (ctx->trace_enable) { +- bits[i] = 0; +- ff_cbs_trace_syntax_element(ctx, position, +- name, NULL, bits, value); +- } ++ CBS_TRACE_READ_END_NO_SUBSCRIPTS(); + + *write_to = value; + return 0; +@@ -349,6 +276,8 @@ static int cbs_av1_write_increment(CodedBitstreamContext *ctx, PutBitContext *pb + { + int len; + ++ CBS_TRACE_WRITE_START(); ++ + av_assert0(range_min <= range_max && range_max - range_min < 32); + if (value < range_min || value > range_max) { + av_log(ctx->log_ctx, AV_LOG_ERROR, "%s out of range: " +@@ -364,23 +293,11 @@ static int cbs_av1_write_increment(CodedBitstreamContext *ctx, PutBitContext *pb + if (put_bits_left(pbc) < len) + return AVERROR(ENOSPC); + +- if (ctx->trace_enable) { +- char bits[33]; +- int i; +- for (i = 0; i < len; i++) { +- if (range_min + i == value) +- bits[i] = '0'; +- else +- bits[i] = '1'; +- } +- bits[i] = 0; +- ff_cbs_trace_syntax_element(ctx, put_bits_count(pbc), +- name, NULL, bits, value); +- } +- + if (len > 0) + put_bits(pbc, len, (1 << len) - 1 - (value != range_max)); + ++ CBS_TRACE_WRITE_END_NO_SUBSCRIPTS(); ++ + return 0; + } + +@@ -388,12 +305,10 @@ static int cbs_av1_read_subexp(CodedBitstreamContext *ctx, GetBitContext *gbc, + uint32_t range_max, const char *name, + const int *subscripts, uint32_t *write_to) + { +- uint32_t value; +- int position, err; +- uint32_t max_len, len, range_offset, range_bits; ++ uint32_t value, max_len, len, range_offset, range_bits; ++ int err; + +- if (ctx->trace_enable) +- position = get_bits_count(gbc); ++ CBS_TRACE_READ_START(); + + av_assert0(range_max > 0); + max_len = av_log2(range_max - 1) - 3; +@@ -412,9 +327,8 @@ static int cbs_av1_read_subexp(CodedBitstreamContext *ctx, GetBitContext *gbc, + } + + if (len < max_len) { +- err = ff_cbs_read_unsigned(ctx, gbc, range_bits, +- "subexp_bits", NULL, &value, +- 0, MAX_UINT_BITS(range_bits)); ++ err = ff_cbs_read_simple_unsigned(ctx, gbc, range_bits, ++ "subexp_bits", &value); + if (err < 0) + return err; + +@@ -426,9 +340,7 @@ static int cbs_av1_read_subexp(CodedBitstreamContext *ctx, GetBitContext *gbc, + } + value += range_offset; + +- if (ctx->trace_enable) +- ff_cbs_trace_syntax_element(ctx, position, +- name, subscripts, "", value); ++ CBS_TRACE_READ_END_VALUE_ONLY(); + + *write_to = value; + return err; +@@ -438,9 +350,11 @@ static int cbs_av1_write_subexp(CodedBitstreamContext *ctx, PutBitContext *pbc, + uint32_t range_max, const char *name, + const int *subscripts, uint32_t value) + { +- int position, err; ++ int err; + uint32_t max_len, len, range_offset, range_bits; + ++ CBS_TRACE_WRITE_START(); ++ + if (value > range_max) { + av_log(ctx->log_ctx, AV_LOG_ERROR, "%s out of range: " + "%"PRIu32", but must be in [0,%"PRIu32"].\n", +@@ -448,9 +362,6 @@ static int cbs_av1_write_subexp(CodedBitstreamContext *ctx, PutBitContext *pbc, + return AVERROR_INVALIDDATA; + } + +- if (ctx->trace_enable) +- position = put_bits_count(pbc); +- + av_assert0(range_max > 0); + max_len = av_log2(range_max - 1) - 3; + +@@ -476,10 +387,9 @@ static int cbs_av1_write_subexp(CodedBitstreamContext *ctx, PutBitContext *pbc, + return err; + + if (len < max_len) { +- err = ff_cbs_write_unsigned(ctx, pbc, range_bits, +- "subexp_bits", NULL, +- value - range_offset, +- 0, MAX_UINT_BITS(range_bits)); ++ err = ff_cbs_write_simple_unsigned(ctx, pbc, range_bits, ++ "subexp_bits", ++ value - range_offset); + if (err < 0) + return err; + +@@ -491,9 +401,7 @@ static int cbs_av1_write_subexp(CodedBitstreamContext *ctx, PutBitContext *pbc, + return err; + } + +- if (ctx->trace_enable) +- ff_cbs_trace_syntax_element(ctx, position, +- name, subscripts, "", value); ++ CBS_TRACE_WRITE_END_VALUE_ONLY(); + + return err; + } +@@ -546,8 +454,6 @@ static size_t cbs_av1_get_payload_bytes_left(GetBitContext *gbc) + + #define SUBSCRIPTS(subs, ...) (subs > 0 ? ((int[subs + 1]){ subs, __VA_ARGS__ }) : NULL) + +-#define fb(width, name) \ +- xf(width, name, current->name, 0, MAX_UINT_BITS(width), 0, ) + #define fc(width, name, range_min, range_max) \ + xf(width, name, current->name, range_min, range_max, 0, ) + #define flag(name) fb(1, name) +@@ -573,6 +479,13 @@ static size_t cbs_av1_get_payload_bytes_left(GetBitContext *gbc) + #define READWRITE read + #define RWContext GetBitContext + ++#define fb(width, name) do { \ ++ uint32_t value; \ ++ CHECK(ff_cbs_read_simple_unsigned(ctx, rw, width, \ ++ #name, &value)); \ ++ current->name = value; \ ++ } while (0) ++ + #define xf(width, name, var, range_min, range_max, subs, ...) do { \ + uint32_t value; \ + CHECK(ff_cbs_read_unsigned(ctx, rw, width, #name, \ +@@ -645,6 +558,7 @@ static size_t cbs_av1_get_payload_bytes_left(GetBitContext *gbc) + #undef READ + #undef READWRITE + #undef RWContext ++#undef fb + #undef xf + #undef xsu + #undef uvlc +@@ -661,6 +575,11 @@ static size_t cbs_av1_get_payload_bytes_left(GetBitContext *gbc) + #define READWRITE write + #define RWContext PutBitContext + ++#define fb(width, name) do { \ ++ CHECK(ff_cbs_write_simple_unsigned(ctx, rw, width, #name, \ ++ current->name)); \ ++ } while (0) ++ + #define xf(width, name, var, range_min, range_max, subs, ...) do { \ + CHECK(ff_cbs_write_unsigned(ctx, rw, width, #name, \ + SUBSCRIPTS(subs, __VA_ARGS__), \ +@@ -703,7 +622,7 @@ static size_t cbs_av1_get_payload_bytes_left(GetBitContext *gbc) + } while (0) + + #define leb128(name) do { \ +- CHECK(cbs_av1_write_leb128(ctx, rw, #name, current->name)); \ ++ CHECK(cbs_av1_write_leb128(ctx, rw, #name, current->name, 0)); \ + } while (0) + + #define infer(name, value) do { \ +@@ -723,6 +642,7 @@ static size_t cbs_av1_get_payload_bytes_left(GetBitContext *gbc) + #undef WRITE + #undef READWRITE + #undef RWContext ++#undef fb + #undef xf + #undef xsu + #undef uvlc +@@ -1086,9 +1006,14 @@ static int cbs_av1_write_obu(CodedBitstreamContext *ctx, + + if (obu->header.obu_has_size_field) { + pbc_tmp = *pbc; +- // Add space for the size field to fill later. +- put_bits32(pbc, 0); +- put_bits32(pbc, 0); ++ if (obu->obu_size_byte_len) { ++ for (int i = 0; i < obu->obu_size_byte_len; i++) ++ put_bits(pbc, 8, 0); ++ } else { ++ // Add space for the size field to fill later. ++ put_bits32(pbc, 0); ++ put_bits32(pbc, 0); ++ } + } + + td = NULL; +@@ -1208,7 +1133,7 @@ static int cbs_av1_write_obu(CodedBitstreamContext *ctx, + end_pos /= 8; + + *pbc = pbc_tmp; +- err = cbs_av1_write_leb128(ctx, pbc, "obu_size", obu->obu_size); ++ err = cbs_av1_write_leb128(ctx, pbc, "obu_size", obu->obu_size, obu->obu_size_byte_len); + if (err < 0) + goto error; + +@@ -1225,8 +1150,11 @@ static int cbs_av1_write_obu(CodedBitstreamContext *ctx, + } + + if (obu->obu_size > 0) { +- memmove(pbc->buf + data_pos, +- pbc->buf + start_pos, header_size); ++ if (!obu->obu_size_byte_len) { ++ obu->obu_size_byte_len = start_pos - data_pos; ++ memmove(pbc->buf + data_pos, ++ pbc->buf + start_pos, header_size); ++ } + skip_put_bytes(pbc, header_size); + + if (td) { +diff --git a/libavcodec/cbs_av1.h b/libavcodec/cbs_av1.h +index 1fc80dc..c5dae3c 100644 +--- a/libavcodec/cbs_av1.h ++++ b/libavcodec/cbs_av1.h +@@ -392,6 +392,7 @@ typedef struct AV1RawOBU { + AV1RawOBUHeader header; + + size_t obu_size; ++ uint8_t obu_size_byte_len; + + union { + AV1RawSequenceHeader sequence_header; +diff --git a/libavcodec/cbs_av1_syntax_template.c b/libavcodec/cbs_av1_syntax_template.c +index e95925a..cf2e259 100644 +--- a/libavcodec/cbs_av1_syntax_template.c ++++ b/libavcodec/cbs_av1_syntax_template.c +@@ -1018,9 +1018,9 @@ static int FUNC(read_tx_mode)(CodedBitstreamContext *ctx, RWContext *rw, + int err; + + if (priv->coded_lossless) +- infer(tx_mode, 0); ++ infer(tx_mode, AV1_ONLY_4X4); + else +- increment(tx_mode, 1, 2); ++ increment(tx_mode, AV1_TX_MODE_LARGEST, AV1_TX_MODE_SELECT); + + return 0; + } +diff --git a/libavcodec/cbs_bsf.c b/libavcodec/cbs_bsf.c +index 069f6e9..b252854 100644 +--- a/libavcodec/cbs_bsf.c ++++ b/libavcodec/cbs_bsf.c +@@ -123,6 +123,11 @@ int ff_cbs_bsf_generic_init(AVBSFContext *bsf, const CBSBSFType *type) + if (err < 0) + return err; + ++ ctx->output->trace_enable = 1; ++ ctx->output->trace_level = AV_LOG_TRACE; ++ ctx->output->trace_context = ctx->output; ++ ctx->output->trace_write_callback = ff_cbs_trace_write_log; ++ + if (bsf->par_in->extradata) { + err = ff_cbs_read_extradata(ctx->input, frag, bsf->par_in); + if (err < 0) { +diff --git a/libavcodec/cbs_h2645.c b/libavcodec/cbs_h2645.c +index 80e4882..355f4d5 100644 +--- a/libavcodec/cbs_h2645.c ++++ b/libavcodec/cbs_h2645.c +@@ -34,41 +34,38 @@ static int cbs_read_ue_golomb(CodedBitstreamContext *ctx, GetBitContext *gbc, + uint32_t *write_to, + uint32_t range_min, uint32_t range_max) + { +- uint32_t value; +- int position, i, j; +- unsigned int k; +- char bits[65]; ++ uint32_t leading_bits, value; ++ int max_length, leading_zeroes; + +- position = get_bits_count(gbc); ++ CBS_TRACE_READ_START(); + +- for (i = 0; i < 32; i++) { +- if (get_bits_left(gbc) < i + 1) { ++ max_length = FFMIN(get_bits_left(gbc), 32); ++ ++ leading_bits = show_bits_long(gbc, max_length); ++ if (leading_bits == 0) { ++ if (max_length >= 32) { ++ av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid ue-golomb code at " ++ "%s: more than 31 zeroes.\n", name); ++ return AVERROR_INVALIDDATA; ++ } else { + av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid ue-golomb code at " + "%s: bitstream ended.\n", name); + return AVERROR_INVALIDDATA; + } +- k = get_bits1(gbc); +- bits[i] = k ? '1' : '0'; +- if (k) +- break; + } +- if (i >= 32) { ++ ++ leading_zeroes = max_length - 1 - av_log2(leading_bits); ++ skip_bits_long(gbc, leading_zeroes); ++ ++ if (get_bits_left(gbc) < leading_zeroes + 1) { + av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid ue-golomb code at " +- "%s: more than 31 zeroes.\n", name); ++ "%s: bitstream ended.\n", name); + return AVERROR_INVALIDDATA; + } +- value = 1; +- for (j = 0; j < i; j++) { +- k = get_bits1(gbc); +- bits[i + j + 1] = k ? '1' : '0'; +- value = value << 1 | k; +- } +- bits[i + j + 1] = 0; +- --value; + +- if (ctx->trace_enable) +- ff_cbs_trace_syntax_element(ctx, position, name, subscripts, +- bits, value); ++ value = get_bits_long(gbc, leading_zeroes + 1) - 1; ++ ++ CBS_TRACE_READ_END(); + + if (value < range_min || value > range_max) { + av_log(ctx->log_ctx, AV_LOG_ERROR, "%s out of range: " +@@ -86,45 +83,44 @@ static int cbs_read_se_golomb(CodedBitstreamContext *ctx, GetBitContext *gbc, + int32_t *write_to, + int32_t range_min, int32_t range_max) + { ++ uint32_t leading_bits, unsigned_value; ++ int max_length, leading_zeroes; + int32_t value; +- int position, i, j; +- unsigned int k; +- uint32_t v; +- char bits[65]; + +- position = get_bits_count(gbc); ++ CBS_TRACE_READ_START(); + +- for (i = 0; i < 32; i++) { +- if (get_bits_left(gbc) < i + 1) { ++ max_length = FFMIN(get_bits_left(gbc), 32); ++ ++ leading_bits = show_bits_long(gbc, max_length); ++ if (leading_bits == 0) { ++ if (max_length >= 32) { ++ av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid se-golomb code at " ++ "%s: more than 31 zeroes.\n", name); ++ return AVERROR_INVALIDDATA; ++ } else { + av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid se-golomb code at " + "%s: bitstream ended.\n", name); + return AVERROR_INVALIDDATA; + } +- k = get_bits1(gbc); +- bits[i] = k ? '1' : '0'; +- if (k) +- break; + } +- if (i >= 32) { ++ ++ leading_zeroes = max_length - 1 - av_log2(leading_bits); ++ skip_bits_long(gbc, leading_zeroes); ++ ++ if (get_bits_left(gbc) < leading_zeroes + 1) { + av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid se-golomb code at " +- "%s: more than 31 zeroes.\n", name); ++ "%s: bitstream ended.\n", name); + return AVERROR_INVALIDDATA; + } +- v = 1; +- for (j = 0; j < i; j++) { +- k = get_bits1(gbc); +- bits[i + j + 1] = k ? '1' : '0'; +- v = v << 1 | k; +- } +- bits[i + j + 1] = 0; +- if (v & 1) +- value = -(int32_t)(v / 2); ++ ++ unsigned_value = get_bits_long(gbc, leading_zeroes + 1); ++ ++ if (unsigned_value & 1) ++ value = -(int32_t)(unsigned_value / 2); + else +- value = v / 2; ++ value = unsigned_value / 2; + +- if (ctx->trace_enable) +- ff_cbs_trace_syntax_element(ctx, position, name, subscripts, +- bits, value); ++ CBS_TRACE_READ_END(); + + if (value < range_min || value > range_max) { + av_log(ctx->log_ctx, AV_LOG_ERROR, "%s out of range: " +@@ -144,6 +140,8 @@ static int cbs_write_ue_golomb(CodedBitstreamContext *ctx, PutBitContext *pbc, + { + int len; + ++ CBS_TRACE_WRITE_START(); ++ + if (value < range_min || value > range_max) { + av_log(ctx->log_ctx, AV_LOG_ERROR, "%s out of range: " + "%"PRIu32", but must be in [%"PRIu32",%"PRIu32"].\n", +@@ -156,27 +154,14 @@ static int cbs_write_ue_golomb(CodedBitstreamContext *ctx, PutBitContext *pbc, + if (put_bits_left(pbc) < 2 * len + 1) + return AVERROR(ENOSPC); + +- if (ctx->trace_enable) { +- char bits[65]; +- int i; +- +- for (i = 0; i < len; i++) +- bits[i] = '0'; +- bits[len] = '1'; +- for (i = 0; i < len; i++) +- bits[len + i + 1] = (value + 1) >> (len - i - 1) & 1 ? '1' : '0'; +- bits[len + len + 1] = 0; +- +- ff_cbs_trace_syntax_element(ctx, put_bits_count(pbc), +- name, subscripts, bits, value); +- } +- + put_bits(pbc, len, 0); + if (len + 1 < 32) + put_bits(pbc, len + 1, value + 1); + else + put_bits32(pbc, value + 1); + ++ CBS_TRACE_WRITE_END(); ++ + return 0; + } + +@@ -188,6 +173,8 @@ static int cbs_write_se_golomb(CodedBitstreamContext *ctx, PutBitContext *pbc, + int len; + uint32_t uvalue; + ++ CBS_TRACE_WRITE_START(); ++ + if (value < range_min || value > range_max) { + av_log(ctx->log_ctx, AV_LOG_ERROR, "%s out of range: " + "%"PRId32", but must be in [%"PRId32",%"PRId32"].\n", +@@ -207,27 +194,14 @@ static int cbs_write_se_golomb(CodedBitstreamContext *ctx, PutBitContext *pbc, + if (put_bits_left(pbc) < 2 * len + 1) + return AVERROR(ENOSPC); + +- if (ctx->trace_enable) { +- char bits[65]; +- int i; +- +- for (i = 0; i < len; i++) +- bits[i] = '0'; +- bits[len] = '1'; +- for (i = 0; i < len; i++) +- bits[len + i + 1] = (uvalue + 1) >> (len - i - 1) & 1 ? '1' : '0'; +- bits[len + len + 1] = 0; +- +- ff_cbs_trace_syntax_element(ctx, put_bits_count(pbc), +- name, subscripts, bits, value); +- } +- + put_bits(pbc, len, 0); + if (len + 1 < 32) + put_bits(pbc, len + 1, uvalue + 1); + else + put_bits32(pbc, uvalue + 1); + ++ CBS_TRACE_WRITE_END(); ++ + return 0; + } + +@@ -261,8 +235,6 @@ static int cbs_h265_payload_extension_present(GetBitContext *gbc, uint32_t paylo + + #define u(width, name, range_min, range_max) \ + xu(width, name, current->name, range_min, range_max, 0, ) +-#define ub(width, name) \ +- xu(width, name, current->name, 0, MAX_UINT_BITS(width), 0, ) + #define flag(name) ub(1, name) + #define ue(name, range_min, range_max) \ + xue(name, current->name, range_min, range_max, 0, ) +@@ -298,6 +270,12 @@ static int cbs_h265_payload_extension_present(GetBitContext *gbc, uint32_t paylo + #define READWRITE read + #define RWContext GetBitContext + ++#define ub(width, name) do { \ ++ uint32_t value; \ ++ CHECK(ff_cbs_read_simple_unsigned(ctx, rw, width, #name, \ ++ &value)); \ ++ current->name = value; \ ++ } while (0) + #define xu(width, name, var, range_min, range_max, subs, ...) do { \ + uint32_t value; \ + CHECK(ff_cbs_read_unsigned(ctx, rw, width, #name, \ +@@ -372,6 +350,7 @@ static int cbs_h2645_read_more_rbsp_data(GetBitContext *gbc) + #undef READ + #undef READWRITE + #undef RWContext ++#undef ub + #undef xu + #undef xi + #undef xue +@@ -387,6 +366,11 @@ static int cbs_h2645_read_more_rbsp_data(GetBitContext *gbc) + #define READWRITE write + #define RWContext PutBitContext + ++#define ub(width, name) do { \ ++ uint32_t value = current->name; \ ++ CHECK(ff_cbs_write_simple_unsigned(ctx, rw, width, #name, \ ++ value)); \ ++ } while (0) + #define xu(width, name, var, range_min, range_max, subs, ...) do { \ + uint32_t value = var; \ + CHECK(ff_cbs_write_unsigned(ctx, rw, width, #name, \ +@@ -450,6 +434,7 @@ static int cbs_h2645_read_more_rbsp_data(GetBitContext *gbc) + #undef WRITE + #undef READWRITE + #undef RWContext ++#undef ub + #undef xu + #undef xi + #undef xue +diff --git a/libavcodec/cbs_internal.h b/libavcodec/cbs_internal.h +index e585c77..60e31eb 100644 +--- a/libavcodec/cbs_internal.h ++++ b/libavcodec/cbs_internal.h +@@ -151,24 +151,29 @@ typedef struct CodedBitstreamType { + void ff_cbs_trace_header(CodedBitstreamContext *ctx, + const char *name); + +-void ff_cbs_trace_syntax_element(CodedBitstreamContext *ctx, int position, +- const char *name, const int *subscripts, +- const char *bitstring, int64_t value); +- + + // Helper functions for read/write of common bitstream elements, including +-// generation of trace output. ++// generation of trace output. The simple functions are equivalent to ++// their non-simple counterparts except that their range is unrestricted ++// (i.e. only limited by the amount of bits used) and they lack ++// the ability to use subscripts. + + int ff_cbs_read_unsigned(CodedBitstreamContext *ctx, GetBitContext *gbc, + int width, const char *name, + const int *subscripts, uint32_t *write_to, + uint32_t range_min, uint32_t range_max); + ++int ff_cbs_read_simple_unsigned(CodedBitstreamContext *ctx, GetBitContext *gbc, ++ int width, const char *name, uint32_t *write_to); ++ + int ff_cbs_write_unsigned(CodedBitstreamContext *ctx, PutBitContext *pbc, + int width, const char *name, + const int *subscripts, uint32_t value, + uint32_t range_min, uint32_t range_max); + ++int ff_cbs_write_simple_unsigned(CodedBitstreamContext *ctx, PutBitContext *pbc, ++ int width, const char *name, uint32_t value); ++ + int ff_cbs_read_signed(CodedBitstreamContext *ctx, GetBitContext *gbc, + int width, const char *name, + const int *subscripts, int32_t *write_to, +@@ -191,6 +196,87 @@ int ff_cbs_write_signed(CodedBitstreamContext *ctx, PutBitContext *pbc, + // range_min in the above functions. + #define MIN_INT_BITS(length) (-(INT64_C(1) << ((length) - 1))) + ++ ++// Start of a syntax element during read tracing. ++#define CBS_TRACE_READ_START() \ ++ GetBitContext trace_start; \ ++ do { \ ++ if (ctx->trace_enable) \ ++ trace_start = *gbc; \ ++ } while (0) ++ ++// End of a syntax element for tracing, make callback. ++#define CBS_TRACE_READ_END() \ ++ do { \ ++ if (ctx->trace_enable) { \ ++ int start_position = get_bits_count(&trace_start); \ ++ int end_position = get_bits_count(gbc); \ ++ av_assert0(start_position <= end_position); \ ++ ctx->trace_read_callback(ctx->trace_context, &trace_start, \ ++ end_position - start_position, \ ++ name, subscripts, value); \ ++ } \ ++ } while (0) ++ ++// End of a syntax element with no subscript entries. ++#define CBS_TRACE_READ_END_NO_SUBSCRIPTS() \ ++ do { \ ++ const int *subscripts = NULL; \ ++ CBS_TRACE_READ_END(); \ ++ } while (0) ++ ++// End of a syntax element which is made up of subelements which ++// are aleady traced, so we are only showing the value. ++#define CBS_TRACE_READ_END_VALUE_ONLY() \ ++ do { \ ++ if (ctx->trace_enable) { \ ++ ctx->trace_read_callback(ctx->trace_context, &trace_start, 0, \ ++ name, subscripts, value); \ ++ } \ ++ } while (0) ++ ++// Start of a syntax element during write tracing. ++#define CBS_TRACE_WRITE_START() \ ++ int start_position; \ ++ do { \ ++ if (ctx->trace_enable) \ ++ start_position = put_bits_count(pbc);; \ ++ } while (0) ++ ++// End of a syntax element for tracing, make callback. ++#define CBS_TRACE_WRITE_END() \ ++ do { \ ++ if (ctx->trace_enable) { \ ++ int end_position = put_bits_count(pbc); \ ++ av_assert0(start_position <= end_position); \ ++ ctx->trace_write_callback(ctx->trace_context, pbc, \ ++ end_position - start_position, \ ++ name, subscripts, value); \ ++ } \ ++ } while (0) ++ ++// End of a syntax element with no subscript entries. ++#define CBS_TRACE_WRITE_END_NO_SUBSCRIPTS() \ ++ do { \ ++ const int *subscripts = NULL; \ ++ CBS_TRACE_WRITE_END(); \ ++ } while (0) ++ ++// End of a syntax element which is made up of subelements which are ++// aleady traced, so we are only showing the value. This forges a ++// PutBitContext to point to the position of the start of the syntax ++// element, but the other state doesn't matter because length is zero. ++#define CBS_TRACE_WRITE_END_VALUE_ONLY() \ ++ do { \ ++ if (ctx->trace_enable) { \ ++ PutBitContext tmp; \ ++ init_put_bits(&tmp, pbc->buf, start_position); \ ++ skip_put_bits(&tmp, start_position); \ ++ ctx->trace_write_callback(ctx->trace_context, &tmp, 0, \ ++ name, subscripts, value); \ ++ } \ ++ } while (0) ++ + #define TYPE_LIST(...) { __VA_ARGS__ } + #define CBS_UNIT_TYPE_POD(type_, structure) { \ + .nb_unit_types = 1, \ +diff --git a/libavcodec/cbs_mpeg2.c b/libavcodec/cbs_mpeg2.c +index 04b0c7f..37fc28a 100644 +--- a/libavcodec/cbs_mpeg2.c ++++ b/libavcodec/cbs_mpeg2.c +@@ -40,8 +40,6 @@ + + #define SUBSCRIPTS(subs, ...) (subs > 0 ? ((int[subs + 1]){ subs, __VA_ARGS__ }) : NULL) + +-#define ui(width, name) \ +- xui(width, name, current->name, 0, MAX_UINT_BITS(width), 0, ) + #define uir(width, name) \ + xui(width, name, current->name, 1, MAX_UINT_BITS(width), 0, ) + #define uis(width, name, subs, ...) \ +@@ -65,6 +63,12 @@ + #define READWRITE read + #define RWContext GetBitContext + ++#define ui(width, name) do { \ ++ uint32_t value; \ ++ CHECK(ff_cbs_read_simple_unsigned(ctx, rw, width, #name, \ ++ &value)); \ ++ current->name = value; \ ++ } while (0) + #define xuia(width, string, var, range_min, range_max, subs, ...) do { \ + uint32_t value; \ + CHECK(ff_cbs_read_unsigned(ctx, rw, width, string, \ +@@ -95,6 +99,7 @@ + #undef READ + #undef READWRITE + #undef RWContext ++#undef ui + #undef xuia + #undef xsi + #undef nextbits +@@ -105,6 +110,11 @@ + #define READWRITE write + #define RWContext PutBitContext + ++#define ui(width, name) do { \ ++ CHECK(ff_cbs_write_simple_unsigned(ctx, rw, width, #name, \ ++ current->name)); \ ++ } while (0) ++ + #define xuia(width, string, var, range_min, range_max, subs, ...) do { \ + CHECK(ff_cbs_write_unsigned(ctx, rw, width, string, \ + SUBSCRIPTS(subs, __VA_ARGS__), \ +@@ -134,6 +144,7 @@ + #undef WRITE + #undef READWRITE + #undef RWContext ++#undef ui + #undef xuia + #undef xsi + #undef nextbits +diff --git a/libavcodec/cbs_vp9.c b/libavcodec/cbs_vp9.c +index 184fdca..816d06d 100644 +--- a/libavcodec/cbs_vp9.c ++++ b/libavcodec/cbs_vp9.c +@@ -28,11 +28,10 @@ static int cbs_vp9_read_s(CodedBitstreamContext *ctx, GetBitContext *gbc, + const int *subscripts, int32_t *write_to) + { + uint32_t magnitude; +- int position, sign; ++ int sign; + int32_t value; + +- if (ctx->trace_enable) +- position = get_bits_count(gbc); ++ CBS_TRACE_READ_START(); + + if (get_bits_left(gbc) < width + 1) { + av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid signed value at " +@@ -44,17 +43,7 @@ static int cbs_vp9_read_s(CodedBitstreamContext *ctx, GetBitContext *gbc, + sign = get_bits1(gbc); + value = sign ? -(int32_t)magnitude : magnitude; + +- if (ctx->trace_enable) { +- char bits[33]; +- int i; +- for (i = 0; i < width; i++) +- bits[i] = magnitude >> (width - i - 1) & 1 ? '1' : '0'; +- bits[i] = sign ? '1' : '0'; +- bits[i + 1] = 0; +- +- ff_cbs_trace_syntax_element(ctx, position, name, subscripts, +- bits, value); +- } ++ CBS_TRACE_READ_END(); + + *write_to = value; + return 0; +@@ -67,27 +56,19 @@ static int cbs_vp9_write_s(CodedBitstreamContext *ctx, PutBitContext *pbc, + uint32_t magnitude; + int sign; + ++ CBS_TRACE_WRITE_START(); ++ + if (put_bits_left(pbc) < width + 1) + return AVERROR(ENOSPC); + + sign = value < 0; + magnitude = sign ? -value : value; + +- if (ctx->trace_enable) { +- char bits[33]; +- int i; +- for (i = 0; i < width; i++) +- bits[i] = magnitude >> (width - i - 1) & 1 ? '1' : '0'; +- bits[i] = sign ? '1' : '0'; +- bits[i + 1] = 0; +- +- ff_cbs_trace_syntax_element(ctx, put_bits_count(pbc), +- name, subscripts, bits, value); +- } +- + put_bits(pbc, width, magnitude); + put_bits(pbc, 1, sign); + ++ CBS_TRACE_WRITE_END(); ++ + return 0; + } + +@@ -96,32 +77,24 @@ static int cbs_vp9_read_increment(CodedBitstreamContext *ctx, GetBitContext *gbc + const char *name, uint32_t *write_to) + { + uint32_t value; +- int position, i; +- char bits[8]; + +- av_assert0(range_min <= range_max && range_max - range_min < sizeof(bits) - 1); +- if (ctx->trace_enable) +- position = get_bits_count(gbc); ++ CBS_TRACE_READ_START(); ++ ++ av_assert0(range_min <= range_max && range_max - range_min < 32); + +- for (i = 0, value = range_min; value < range_max;) { ++ for (value = range_min; value < range_max;) { + if (get_bits_left(gbc) < 1) { + av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid increment value at " + "%s: bitstream ended.\n", name); + return AVERROR_INVALIDDATA; + } +- if (get_bits1(gbc)) { +- bits[i++] = '1'; ++ if (get_bits1(gbc)) + ++value; +- } else { +- bits[i++] = '0'; ++ else + break; +- } + } + +- if (ctx->trace_enable) { +- bits[i] = 0; +- ff_cbs_trace_syntax_element(ctx, position, name, NULL, bits, value); +- } ++ CBS_TRACE_READ_END_NO_SUBSCRIPTS(); + + *write_to = value; + return 0; +@@ -133,6 +106,8 @@ static int cbs_vp9_write_increment(CodedBitstreamContext *ctx, PutBitContext *pb + { + int len; + ++ CBS_TRACE_WRITE_START(); ++ + av_assert0(range_min <= range_max && range_max - range_min < 8); + if (value < range_min || value > range_max) { + av_log(ctx->log_ctx, AV_LOG_ERROR, "%s out of range: " +@@ -148,23 +123,11 @@ static int cbs_vp9_write_increment(CodedBitstreamContext *ctx, PutBitContext *pb + if (put_bits_left(pbc) < len) + return AVERROR(ENOSPC); + +- if (ctx->trace_enable) { +- char bits[8]; +- int i; +- for (i = 0; i < len; i++) { +- if (range_min + i == value) +- bits[i] = '0'; +- else +- bits[i] = '1'; +- } +- bits[i] = 0; +- ff_cbs_trace_syntax_element(ctx, put_bits_count(pbc), +- name, NULL, bits, value); +- } +- + if (len > 0) + put_bits(pbc, len, (1 << len) - 1 - (value != range_max)); + ++ CBS_TRACE_WRITE_END_NO_SUBSCRIPTS(); ++ + return 0; + } + +@@ -173,12 +136,11 @@ static int cbs_vp9_read_le(CodedBitstreamContext *ctx, GetBitContext *gbc, + const int *subscripts, uint32_t *write_to) + { + uint32_t value; +- int position, b; ++ int b; + +- av_assert0(width % 8 == 0); ++ CBS_TRACE_READ_START(); + +- if (ctx->trace_enable) +- position = get_bits_count(gbc); ++ av_assert0(width % 8 == 0); + + if (get_bits_left(gbc) < width) { + av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid le value at " +@@ -190,17 +152,7 @@ static int cbs_vp9_read_le(CodedBitstreamContext *ctx, GetBitContext *gbc, + for (b = 0; b < width; b += 8) + value |= get_bits(gbc, 8) << b; + +- if (ctx->trace_enable) { +- char bits[33]; +- int i; +- for (b = 0; b < width; b += 8) +- for (i = 0; i < 8; i++) +- bits[b + i] = value >> (b + i) & 1 ? '1' : '0'; +- bits[b] = 0; +- +- ff_cbs_trace_syntax_element(ctx, position, name, subscripts, +- bits, value); +- } ++ CBS_TRACE_READ_END(); + + *write_to = value; + return 0; +@@ -212,26 +164,18 @@ static int cbs_vp9_write_le(CodedBitstreamContext *ctx, PutBitContext *pbc, + { + int b; + ++ CBS_TRACE_WRITE_START(); ++ + av_assert0(width % 8 == 0); + + if (put_bits_left(pbc) < width) + return AVERROR(ENOSPC); + +- if (ctx->trace_enable) { +- char bits[33]; +- int i; +- for (b = 0; b < width; b += 8) +- for (i = 0; i < 8; i++) +- bits[b + i] = value >> (b + i) & 1 ? '1' : '0'; +- bits[b] = 0; +- +- ff_cbs_trace_syntax_element(ctx, put_bits_count(pbc), +- name, subscripts, bits, value); +- } +- + for (b = 0; b < width; b += 8) + put_bits(pbc, 8, value >> b & 0xff); + ++ CBS_TRACE_WRITE_END(); ++ + return 0; + } + +@@ -251,8 +195,6 @@ static int cbs_vp9_write_le(CodedBitstreamContext *ctx, PutBitContext *pbc, + + #define SUBSCRIPTS(subs, ...) (subs > 0 ? ((int[subs + 1]){ subs, __VA_ARGS__ }) : NULL) + +-#define f(width, name) \ +- xf(width, name, current->name, 0, ) + #define s(width, name) \ + xs(width, name, current->name, 0, ) + #define fs(width, name, subs, ...) \ +@@ -264,6 +206,12 @@ static int cbs_vp9_write_le(CodedBitstreamContext *ctx, PutBitContext *pbc, + #define READWRITE read + #define RWContext GetBitContext + ++#define f(width, name) do { \ ++ uint32_t value; \ ++ CHECK(ff_cbs_read_simple_unsigned(ctx, rw, width, #name, \ ++ &value)); \ ++ current->name = value; \ ++ } while (0) + #define xf(width, name, var, subs, ...) do { \ + uint32_t value; \ + CHECK(ff_cbs_read_unsigned(ctx, rw, width, #name, \ +@@ -329,6 +277,7 @@ static int cbs_vp9_write_le(CodedBitstreamContext *ctx, PutBitContext *pbc, + #undef READ + #undef READWRITE + #undef RWContext ++#undef f + #undef xf + #undef xs + #undef increment +@@ -344,6 +293,10 @@ static int cbs_vp9_write_le(CodedBitstreamContext *ctx, PutBitContext *pbc, + #define READWRITE write + #define RWContext PutBitContext + ++#define f(width, name) do { \ ++ CHECK(ff_cbs_write_simple_unsigned(ctx, rw, width, #name, \ ++ current->name)); \ ++ } while (0) + #define xf(width, name, var, subs, ...) do { \ + CHECK(ff_cbs_write_unsigned(ctx, rw, width, #name, \ + SUBSCRIPTS(subs, __VA_ARGS__), \ +@@ -396,6 +349,7 @@ static int cbs_vp9_write_le(CodedBitstreamContext *ctx, PutBitContext *pbc, + #undef WRITE + #undef READWRITE + #undef RWContext ++#undef f + #undef xf + #undef xs + #undef increment +diff --git a/libavcodec/extract_extradata_bsf.c b/libavcodec/extract_extradata_bsf.c +index 329b1a6..7eedb16 100644 +--- a/libavcodec/extract_extradata_bsf.c ++++ b/libavcodec/extract_extradata_bsf.c +@@ -48,10 +48,9 @@ typedef struct ExtractExtradataContext { + int remove; + } ExtractExtradataContext; + +-static int val_in_array(const int *arr, int len, int val) ++static int val_in_array(const int *arr, size_t len, int val) + { +- int i; +- for (i = 0; i < len; i++) ++ for (size_t i = 0; i < len; i++) + if (arr[i] == val) + return 1; + return 0; +@@ -145,7 +144,7 @@ static int extract_extradata_h2645(AVBSFContext *ctx, AVPacket *pkt, + + int extradata_size = 0, filtered_size = 0; + const int *extradata_nal_types; +- int nb_extradata_nal_types; ++ size_t nb_extradata_nal_types; + int i, has_sps = 0, has_vps = 0, ret = 0; + + if (ctx->par_in->codec_id == AV_CODEC_ID_HEVC) { +diff --git a/libavcodec/trace_headers_bsf.c b/libavcodec/trace_headers_bsf.c +index 028b0a1..8781f5f 100644 +--- a/libavcodec/trace_headers_bsf.c ++++ b/libavcodec/trace_headers_bsf.c +@@ -44,6 +44,8 @@ static int trace_headers_init(AVBSFContext *bsf) + + ctx->cbc->trace_enable = 1; + ctx->cbc->trace_level = AV_LOG_INFO; ++ ctx->cbc->trace_context = ctx->cbc; ++ ctx->cbc->trace_read_callback = ff_cbs_trace_read_log; + + if (bsf->par_in->extradata) { + CodedBitstreamFragment *frag = &ctx->fragment; +diff --git a/libavcodec/vaapi_encode.c b/libavcodec/vaapi_encode.c +index bfca315..f5bf5ab 100644 +--- a/libavcodec/vaapi_encode.c ++++ b/libavcodec/vaapi_encode.c +@@ -276,21 +276,34 @@ static int vaapi_encode_issue(AVCodecContext *avctx, + av_log(avctx, AV_LOG_DEBUG, "Issuing encode for pic %"PRId64"/%"PRId64" " + "as type %s.\n", pic->display_order, pic->encode_order, + picture_type_name[pic->type]); +- if (pic->nb_refs == 0) { ++ if (pic->nb_refs[0] == 0 && pic->nb_refs[1] == 0) { + av_log(avctx, AV_LOG_DEBUG, "No reference pictures.\n"); + } else { +- av_log(avctx, AV_LOG_DEBUG, "Refers to:"); +- for (i = 0; i < pic->nb_refs; i++) { ++ av_log(avctx, AV_LOG_DEBUG, "L0 refers to"); ++ for (i = 0; i < pic->nb_refs[0]; i++) { + av_log(avctx, AV_LOG_DEBUG, " %"PRId64"/%"PRId64, +- pic->refs[i]->display_order, pic->refs[i]->encode_order); ++ pic->refs[0][i]->display_order, pic->refs[0][i]->encode_order); + } + av_log(avctx, AV_LOG_DEBUG, ".\n"); ++ ++ if (pic->nb_refs[1]) { ++ av_log(avctx, AV_LOG_DEBUG, "L1 refers to"); ++ for (i = 0; i < pic->nb_refs[1]; i++) { ++ av_log(avctx, AV_LOG_DEBUG, " %"PRId64"/%"PRId64, ++ pic->refs[1][i]->display_order, pic->refs[1][i]->encode_order); ++ } ++ av_log(avctx, AV_LOG_DEBUG, ".\n"); ++ } + } + + av_assert0(!pic->encode_issued); +- for (i = 0; i < pic->nb_refs; i++) { +- av_assert0(pic->refs[i]); +- av_assert0(pic->refs[i]->encode_issued); ++ for (i = 0; i < pic->nb_refs[0]; i++) { ++ av_assert0(pic->refs[0][i]); ++ av_assert0(pic->refs[0][i]->encode_issued); ++ } ++ for (i = 0; i < pic->nb_refs[1]; i++) { ++ av_assert0(pic->refs[1][i]); ++ av_assert0(pic->refs[1][i]->encode_issued); + } + + av_log(avctx, AV_LOG_DEBUG, "Input surface is %#x.\n", pic->input_surface); +@@ -650,79 +663,200 @@ fail_at_end: + return err; + } + +-static int vaapi_encode_output(AVCodecContext *avctx, +- VAAPIEncodePicture *pic, AVPacket *pkt) ++static int vaapi_encode_set_output_property(AVCodecContext *avctx, ++ VAAPIEncodePicture *pic, ++ AVPacket *pkt) ++{ ++ VAAPIEncodeContext *ctx = avctx->priv_data; ++ ++ if (pic->type == PICTURE_TYPE_IDR) ++ pkt->flags |= AV_PKT_FLAG_KEY; ++ ++ pkt->pts = pic->pts; ++ pkt->duration = pic->duration; ++ ++ // for no-delay encoders this is handled in generic codec ++ if (avctx->codec->capabilities & AV_CODEC_CAP_DELAY && ++ avctx->flags & AV_CODEC_FLAG_COPY_OPAQUE) { ++ pkt->opaque = pic->opaque; ++ pkt->opaque_ref = pic->opaque_ref; ++ pic->opaque_ref = NULL; ++ } ++ ++ if (ctx->codec->flags & FLAG_TIMESTAMP_NO_DELAY) { ++ pkt->dts = pkt->pts; ++ return 0; ++ } ++ ++ if (ctx->output_delay == 0) { ++ pkt->dts = pkt->pts; ++ } else if (pic->encode_order < ctx->decode_delay) { ++ if (ctx->ts_ring[pic->encode_order] < INT64_MIN + ctx->dts_pts_diff) ++ pkt->dts = INT64_MIN; ++ else ++ pkt->dts = ctx->ts_ring[pic->encode_order] - ctx->dts_pts_diff; ++ } else { ++ pkt->dts = ctx->ts_ring[(pic->encode_order - ctx->decode_delay) % ++ (3 * ctx->output_delay + ctx->async_depth)]; ++ } ++ ++ return 0; ++} ++ ++static int vaapi_encode_get_coded_buffer_size(AVCodecContext *avctx, VABufferID buf_id) + { + VAAPIEncodeContext *ctx = avctx->priv_data; + VACodedBufferSegment *buf_list, *buf; ++ int size = 0; + VAStatus vas; +- int total_size = 0; +- uint8_t *ptr; + int err; + +- err = vaapi_encode_wait(avctx, pic); +- if (err < 0) +- return err; +- +- buf_list = NULL; +- vas = vaMapBuffer(ctx->hwctx->display, pic->output_buffer, ++ vas = vaMapBuffer(ctx->hwctx->display, buf_id, + (void**)&buf_list); + if (vas != VA_STATUS_SUCCESS) { + av_log(avctx, AV_LOG_ERROR, "Failed to map output buffers: " + "%d (%s).\n", vas, vaErrorStr(vas)); + err = AVERROR(EIO); +- goto fail; ++ return err; + } + + for (buf = buf_list; buf; buf = buf->next) +- total_size += buf->size; ++ size += buf->size; + +- err = ff_get_encode_buffer(avctx, pkt, total_size, 0); +- ptr = pkt->data; ++ vas = vaUnmapBuffer(ctx->hwctx->display, buf_id); ++ if (vas != VA_STATUS_SUCCESS) { ++ av_log(avctx, AV_LOG_ERROR, "Failed to unmap output buffers: " ++ "%d (%s).\n", vas, vaErrorStr(vas)); ++ err = AVERROR(EIO); ++ return err; ++ } + +- if (err < 0) +- goto fail_mapped; ++ return size; ++} ++ ++static int vaapi_encode_get_coded_buffer_data(AVCodecContext *avctx, ++ VABufferID buf_id, uint8_t **dst) ++{ ++ VAAPIEncodeContext *ctx = avctx->priv_data; ++ VACodedBufferSegment *buf_list, *buf; ++ VAStatus vas; ++ int err; ++ ++ vas = vaMapBuffer(ctx->hwctx->display, buf_id, ++ (void**)&buf_list); ++ if (vas != VA_STATUS_SUCCESS) { ++ av_log(avctx, AV_LOG_ERROR, "Failed to map output buffers: " ++ "%d (%s).\n", vas, vaErrorStr(vas)); ++ err = AVERROR(EIO); ++ return err; ++ } + + for (buf = buf_list; buf; buf = buf->next) { + av_log(avctx, AV_LOG_DEBUG, "Output buffer: %u bytes " + "(status %08x).\n", buf->size, buf->status); + +- memcpy(ptr, buf->buf, buf->size); +- ptr += buf->size; ++ memcpy(*dst, buf->buf, buf->size); ++ *dst += buf->size; + } + +- if (pic->type == PICTURE_TYPE_IDR) +- pkt->flags |= AV_PKT_FLAG_KEY; +- +- pkt->pts = pic->pts; +- pkt->duration = pic->duration; +- +- vas = vaUnmapBuffer(ctx->hwctx->display, pic->output_buffer); ++ vas = vaUnmapBuffer(ctx->hwctx->display, buf_id); + if (vas != VA_STATUS_SUCCESS) { + av_log(avctx, AV_LOG_ERROR, "Failed to unmap output buffers: " + "%d (%s).\n", vas, vaErrorStr(vas)); + err = AVERROR(EIO); +- goto fail; ++ return err; + } + +- // for no-delay encoders this is handled in generic codec +- if (avctx->codec->capabilities & AV_CODEC_CAP_DELAY && +- avctx->flags & AV_CODEC_FLAG_COPY_OPAQUE) { +- pkt->opaque = pic->opaque; +- pkt->opaque_ref = pic->opaque_ref; +- pic->opaque_ref = NULL; ++ return 0; ++} ++ ++static int vaapi_encode_get_coded_data(AVCodecContext *avctx, ++ VAAPIEncodePicture *pic, AVPacket *pkt) ++{ ++ VAAPIEncodeContext *ctx = avctx->priv_data; ++ VABufferID output_buffer_prev; ++ int total_size = 0; ++ uint8_t *ptr; ++ int ret; ++ ++ if (ctx->coded_buffer_ref) { ++ output_buffer_prev = (VABufferID)(uintptr_t)ctx->coded_buffer_ref->data; ++ ret = vaapi_encode_get_coded_buffer_size(avctx, output_buffer_prev); ++ if (ret < 0) ++ goto end; ++ total_size += ret; ++ } ++ ++ ret = vaapi_encode_get_coded_buffer_size(avctx, pic->output_buffer); ++ if (ret < 0) ++ goto end; ++ total_size += ret; ++ ++ ret = ff_get_encode_buffer(avctx, pkt, total_size, 0); ++ if (ret < 0) ++ goto end; ++ ptr = pkt->data; ++ ++ if (ctx->coded_buffer_ref) { ++ ret = vaapi_encode_get_coded_buffer_data(avctx, output_buffer_prev, &ptr); ++ if (ret < 0) ++ goto end; + } + ++ ret = vaapi_encode_get_coded_buffer_data(avctx, pic->output_buffer, &ptr); ++ if (ret < 0) ++ goto end; ++ ++end: ++ if (ctx->coded_buffer_ref) { ++ av_buffer_unref(&ctx->coded_buffer_ref); ++ } + av_buffer_unref(&pic->output_buffer_ref); + pic->output_buffer = VA_INVALID_ID; + ++ return ret; ++} ++ ++static int vaapi_encode_output(AVCodecContext *avctx, ++ VAAPIEncodePicture *pic, AVPacket *pkt) ++{ ++ VAAPIEncodeContext *ctx = avctx->priv_data; ++ AVPacket *pkt_ptr = pkt; ++ int err; ++ ++ err = vaapi_encode_wait(avctx, pic); ++ if (err < 0) ++ return err; ++ ++ if (pic->non_independent_frame) { ++ av_assert0(!ctx->coded_buffer_ref); ++ ctx->coded_buffer_ref = av_buffer_ref(pic->output_buffer_ref); ++ ++ if (pic->tail_size) { ++ if (ctx->tail_pkt->size) { ++ err = AVERROR(AVERROR_BUG); ++ goto end; ++ } ++ ++ err = ff_get_encode_buffer(avctx, ctx->tail_pkt, pic->tail_size, 0); ++ if (err < 0) ++ goto end; ++ ++ memcpy(ctx->tail_pkt->data, pic->tail_data, pic->tail_size); ++ pkt_ptr = ctx->tail_pkt; ++ } ++ } else { ++ err = vaapi_encode_get_coded_data(avctx, pic, pkt); ++ if (err < 0) ++ goto end; ++ } ++ + av_log(avctx, AV_LOG_DEBUG, "Output read for pic %"PRId64"/%"PRId64".\n", + pic->display_order, pic->encode_order); +- return 0; + +-fail_mapped: +- vaUnmapBuffer(ctx->hwctx->display, pic->output_buffer); +-fail: ++ vaapi_encode_set_output_property(avctx, pic, pkt_ptr); ++ ++end: + av_buffer_unref(&pic->output_buffer_ref); + pic->output_buffer = VA_INVALID_ID; + return err; +@@ -811,8 +945,12 @@ static void vaapi_encode_add_ref(AVCodecContext *avctx, + + if (is_ref) { + av_assert0(pic != target); +- av_assert0(pic->nb_refs < MAX_PICTURE_REFERENCES); +- pic->refs[pic->nb_refs++] = target; ++ av_assert0(pic->nb_refs[0] < MAX_PICTURE_REFERENCES && ++ pic->nb_refs[1] < MAX_PICTURE_REFERENCES); ++ if (target->display_order < pic->display_order) ++ pic->refs[0][pic->nb_refs[0]++] = target; ++ else ++ pic->refs[1][pic->nb_refs[1]++] = target; + ++refs; + } + +@@ -841,10 +979,16 @@ static void vaapi_encode_remove_refs(AVCodecContext *avctx, + if (pic->ref_removed[level]) + return; + +- for (i = 0; i < pic->nb_refs; i++) { +- av_assert0(pic->refs[i]); +- --pic->refs[i]->ref_count[level]; +- av_assert0(pic->refs[i]->ref_count[level] >= 0); ++ for (i = 0; i < pic->nb_refs[0]; i++) { ++ av_assert0(pic->refs[0][i]); ++ --pic->refs[0][i]->ref_count[level]; ++ av_assert0(pic->refs[0][i]->ref_count[level] >= 0); ++ } ++ ++ for (i = 0; i < pic->nb_refs[1]; i++) { ++ av_assert0(pic->refs[1][i]); ++ --pic->refs[1][i]->ref_count[level]; ++ av_assert0(pic->refs[1][i]->ref_count[level] >= 0); + } + + for (i = 0; i < pic->nb_dpb_pics; i++) { +@@ -889,7 +1033,7 @@ static void vaapi_encode_set_b_pictures(AVCodecContext *avctx, + vaapi_encode_add_ref(avctx, pic, end, 1, 1, 0); + vaapi_encode_add_ref(avctx, pic, prev, 0, 0, 1); + +- for (ref = end->refs[1]; ref; ref = ref->refs[1]) ++ for (ref = end->refs[1][0]; ref; ref = ref->refs[1][0]) + vaapi_encode_add_ref(avctx, pic, ref, 0, 1, 0); + } + *last = prev; +@@ -912,7 +1056,7 @@ static void vaapi_encode_set_b_pictures(AVCodecContext *avctx, + vaapi_encode_add_ref(avctx, pic, end, 1, 1, 0); + vaapi_encode_add_ref(avctx, pic, prev, 0, 0, 1); + +- for (ref = end->refs[1]; ref; ref = ref->refs[1]) ++ for (ref = end->refs[1][0]; ref; ref = ref->refs[1][0]) + vaapi_encode_add_ref(avctx, pic, ref, 0, 1, 0); + + if (i > 1) +@@ -926,11 +1070,44 @@ static void vaapi_encode_set_b_pictures(AVCodecContext *avctx, + } + } + ++static void vaapi_encode_add_next_prev(AVCodecContext *avctx, ++ VAAPIEncodePicture *pic) ++{ ++ VAAPIEncodeContext *ctx = avctx->priv_data; ++ int i; ++ ++ if (!pic) ++ return; ++ ++ if (pic->type == PICTURE_TYPE_IDR) { ++ for (i = 0; i < ctx->nb_next_prev; i++) { ++ --ctx->next_prev[i]->ref_count[0]; ++ ctx->next_prev[i] = NULL; ++ } ++ ctx->next_prev[0] = pic; ++ ++pic->ref_count[0]; ++ ctx->nb_next_prev = 1; ++ ++ return; ++ } ++ ++ if (ctx->nb_next_prev < MAX_PICTURE_REFERENCES) { ++ ctx->next_prev[ctx->nb_next_prev++] = pic; ++ ++pic->ref_count[0]; ++ } else { ++ --ctx->next_prev[0]->ref_count[0]; ++ for (i = 0; i < MAX_PICTURE_REFERENCES - 1; i++) ++ ctx->next_prev[i] = ctx->next_prev[i + 1]; ++ ctx->next_prev[i] = pic; ++ ++pic->ref_count[0]; ++ } ++} ++ + static int vaapi_encode_pick_next(AVCodecContext *avctx, + VAAPIEncodePicture **pic_out) + { + VAAPIEncodeContext *ctx = avctx->priv_data; +- VAAPIEncodePicture *pic = NULL, *next, *start; ++ VAAPIEncodePicture *pic = NULL, *prev = NULL, *next, *start; + int i, b_counter, closed_gop_end; + + // If there are any B-frames already queued, the next one to encode +@@ -941,11 +1118,18 @@ static int vaapi_encode_pick_next(AVCodecContext *avctx, + continue; + if (pic->type != PICTURE_TYPE_B) + continue; +- for (i = 0; i < pic->nb_refs; i++) { +- if (!pic->refs[i]->encode_issued) ++ for (i = 0; i < pic->nb_refs[0]; i++) { ++ if (!pic->refs[0][i]->encode_issued) ++ break; ++ } ++ if (i != pic->nb_refs[0]) ++ continue; ++ ++ for (i = 0; i < pic->nb_refs[1]; i++) { ++ if (!pic->refs[1][i]->encode_issued) + break; + } +- if (i == pic->nb_refs) ++ if (i == pic->nb_refs[1]) + break; + } + +@@ -1044,21 +1228,30 @@ static int vaapi_encode_pick_next(AVCodecContext *avctx, + + vaapi_encode_add_ref(avctx, pic, pic, 0, 1, 0); + if (pic->type != PICTURE_TYPE_IDR) { +- vaapi_encode_add_ref(avctx, pic, start, +- pic->type == PICTURE_TYPE_P, +- b_counter > 0, 0); +- vaapi_encode_add_ref(avctx, pic, ctx->next_prev, 0, 0, 1); ++ // TODO: apply both previous and forward multi reference for all vaapi encoders. ++ // And L0/L1 reference frame number can be set dynamically through query ++ // VAConfigAttribEncMaxRefFrames attribute. ++ if (avctx->codec_id == AV_CODEC_ID_AV1) { ++ for (i = 0; i < ctx->nb_next_prev; i++) ++ vaapi_encode_add_ref(avctx, pic, ctx->next_prev[i], ++ pic->type == PICTURE_TYPE_P, ++ b_counter > 0, 0); ++ } else ++ vaapi_encode_add_ref(avctx, pic, start, ++ pic->type == PICTURE_TYPE_P, ++ b_counter > 0, 0); ++ ++ vaapi_encode_add_ref(avctx, pic, ctx->next_prev[ctx->nb_next_prev - 1], 0, 0, 1); + } +- if (ctx->next_prev) +- --ctx->next_prev->ref_count[0]; + + if (b_counter > 0) { + vaapi_encode_set_b_pictures(avctx, start, pic, pic, 1, +- &ctx->next_prev); ++ &prev); + } else { +- ctx->next_prev = pic; ++ prev = pic; + } +- ++ctx->next_prev->ref_count[0]; ++ vaapi_encode_add_next_prev(avctx, prev); ++ + return 0; + } + +@@ -1205,10 +1398,23 @@ fail: + int ff_vaapi_encode_receive_packet(AVCodecContext *avctx, AVPacket *pkt) + { + VAAPIEncodeContext *ctx = avctx->priv_data; +- VAAPIEncodePicture *pic; ++ VAAPIEncodePicture *pic = NULL; + AVFrame *frame = ctx->frame; + int err; + ++start: ++ /** if no B frame before repeat P frame, sent repeat P frame out. */ ++ if (ctx->tail_pkt->size) { ++ for (VAAPIEncodePicture *tmp = ctx->pic_start; tmp; tmp = tmp->next) { ++ if (tmp->type == PICTURE_TYPE_B && tmp->pts < ctx->tail_pkt->pts) ++ break; ++ else if (!tmp->next) { ++ av_packet_move_ref(pkt, ctx->tail_pkt); ++ goto end; ++ } ++ } ++ } ++ + err = ff_encode_get_frame(avctx, frame); + if (err < 0 && err != AVERROR_EOF) + return err; +@@ -1228,8 +1434,6 @@ int ff_vaapi_encode_receive_packet(AVCodecContext *avctx, AVPacket *pkt) + } + + if (ctx->has_sync_buffer_func) { +- pic = NULL; +- + if (av_fifo_can_write(ctx->encode_fifo)) { + err = vaapi_encode_pick_next(avctx, &pic); + if (!err) { +@@ -1255,7 +1459,6 @@ int ff_vaapi_encode_receive_packet(AVCodecContext *avctx, AVPacket *pkt) + av_fifo_read(ctx->encode_fifo, &pic, 1); + ctx->encode_order = pic->encode_order + 1; + } else { +- pic = NULL; + err = vaapi_encode_pick_next(avctx, &pic); + if (err < 0) + return err; +@@ -1276,27 +1479,21 @@ int ff_vaapi_encode_receive_packet(AVCodecContext *avctx, AVPacket *pkt) + return err; + } + +- if (ctx->output_delay == 0) { +- pkt->dts = pkt->pts; +- } else if (pic->encode_order < ctx->decode_delay) { +- if (ctx->ts_ring[pic->encode_order] < INT64_MIN + ctx->dts_pts_diff) +- pkt->dts = INT64_MIN; +- else +- pkt->dts = ctx->ts_ring[pic->encode_order] - ctx->dts_pts_diff; +- } else { +- pkt->dts = ctx->ts_ring[(pic->encode_order - ctx->decode_delay) % +- (3 * ctx->output_delay + ctx->async_depth)]; +- } +- av_log(avctx, AV_LOG_DEBUG, "Output packet: pts %"PRId64" dts %"PRId64".\n", +- pkt->pts, pkt->dts); +- + ctx->output_order = pic->encode_order; + vaapi_encode_clear_old(avctx); + ++ /** loop to get an available pkt in encoder flushing. */ ++ if (ctx->end_of_stream && !pkt->size) ++ goto start; ++ ++end: ++ if (pkt->size) ++ av_log(avctx, AV_LOG_DEBUG, "Output packet: pts %"PRId64", dts %"PRId64", " ++ "size %d bytes.\n", pkt->pts, pkt->dts, pkt->size); ++ + return 0; + } + +- + static av_cold void vaapi_encode_add_global_param(AVCodecContext *avctx, int type, + void *buffer, size_t size) + { +@@ -2597,6 +2794,12 @@ av_cold int ff_vaapi_encode_init(AVCodecContext *avctx) + ctx->device = (AVHWDeviceContext*)ctx->device_ref->data; + ctx->hwctx = ctx->device->hwctx; + ++ ctx->tail_pkt = av_packet_alloc(); ++ if (!ctx->tail_pkt) { ++ err = AVERROR(ENOMEM); ++ goto fail; ++ } ++ + err = vaapi_encode_profile_entrypoint(avctx); + if (err < 0) + goto fail; +@@ -2789,6 +2992,7 @@ av_cold int ff_vaapi_encode_close(AVCodecContext *avctx) + } + + av_frame_free(&ctx->frame); ++ av_packet_free(&ctx->tail_pkt); + + av_freep(&ctx->codec_sequence_params); + av_freep(&ctx->codec_picture_params); +diff --git a/libavcodec/vaapi_encode.h b/libavcodec/vaapi_encode.h +index a1e639f..416a3ce 100644 +--- a/libavcodec/vaapi_encode.h ++++ b/libavcodec/vaapi_encode.h +@@ -49,6 +49,7 @@ enum { + // A.4.1: table A.6 allows at most 20 tile columns for any level. + MAX_TILE_COLS = 20, + MAX_ASYNC_DEPTH = 64, ++ MAX_REFERENCE_LIST_NUM = 2, + }; + + extern const AVCodecHWConfigInternal *const ff_vaapi_encode_hw_configs[]; +@@ -116,10 +117,11 @@ typedef struct VAAPIEncodePicture { + // but not if it isn't. + int nb_dpb_pics; + struct VAAPIEncodePicture *dpb[MAX_DPB_SIZE]; +- // The reference pictures used in decoding this picture. If they are +- // used by later pictures they will also appear in the DPB. +- int nb_refs; +- struct VAAPIEncodePicture *refs[MAX_PICTURE_REFERENCES]; ++ // The reference pictures used in decoding this picture. If they are ++ // used by later pictures they will also appear in the DPB. ref[0][] for ++ // previous reference frames. ref[1][] for future reference frames. ++ int nb_refs[MAX_REFERENCE_LIST_NUM]; ++ struct VAAPIEncodePicture *refs[MAX_REFERENCE_LIST_NUM][MAX_PICTURE_REFERENCES]; + // The previous reference picture in encode order. Must be in at least + // one of the reference list and DPB list. + struct VAAPIEncodePicture *prev; +@@ -131,6 +133,17 @@ typedef struct VAAPIEncodePicture { + + int nb_slices; + VAAPIEncodeSlice *slices; ++ ++ /** ++ * indicate if current frame is an independent frame that the coded data ++ * can be pushed to downstream directly. Coded of non-independent frame ++ * data will be concatenated into next independent frame. ++ */ ++ int non_independent_frame; ++ /** Tail data of current pic, used only for repeat header of AV1. */ ++ char tail_data[MAX_PARAM_BUFFER_SIZE]; ++ /** Byte length of tail_data. */ ++ size_t tail_size; + } VAAPIEncodePicture; + + typedef struct VAAPIEncodeProfile { +@@ -290,8 +303,9 @@ typedef struct VAAPIEncodeContext { + // Current encoding window, in display (input) order. + VAAPIEncodePicture *pic_start, *pic_end; + // The next picture to use as the previous reference picture in +- // encoding order. +- VAAPIEncodePicture *next_prev; ++ // encoding order. Order from small to large in encoding order. ++ VAAPIEncodePicture *next_prev[MAX_PICTURE_REFERENCES]; ++ int nb_next_prev; + + // Next input order index (display order). + int64_t input_order; +@@ -364,6 +378,16 @@ typedef struct VAAPIEncodeContext { + AVFifo *encode_fifo; + // Max number of frame buffered in encoder. + int async_depth; ++ ++ /** Head data for current output pkt, used only for AV1. */ ++ //void *header_data; ++ //size_t header_data_size; ++ ++ /** Buffered coded data of a pic if it is an non-independent frame. */ ++ AVBufferRef *coded_buffer_ref; ++ ++ /** Tail data of a pic, now only used for av1 repeat frame header. */ ++ AVPacket *tail_pkt; + } VAAPIEncodeContext; + + enum { +@@ -380,6 +404,9 @@ enum { + // Codec supports non-IDR key pictures (that is, key pictures do + // not necessarily empty the DPB). + FLAG_NON_IDR_KEY_PICTURES = 1 << 5, ++ // Codec output packet without timestamp delay, which means the ++ // output packet has same PTS and DTS. ++ FLAG_TIMESTAMP_NO_DELAY = 1 << 6, + }; + + typedef struct VAAPIEncodeType { +diff --git a/libavcodec/vaapi_encode_av1.c b/libavcodec/vaapi_encode_av1.c +new file mode 100644 +index 0000000..9d101fa +--- /dev/null ++++ b/libavcodec/vaapi_encode_av1.c +@@ -0,0 +1,949 @@ ++/* ++ * Copyright (c) 2023 Intel Corporation ++ * ++ * This file is part of FFmpeg. ++ * ++ * FFmpeg is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * FFmpeg is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with FFmpeg; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ */ ++ ++#include ++#include ++ ++#include "libavutil/pixdesc.h" ++#include "libavutil/opt.h" ++ ++#include "cbs_av1.h" ++#include "put_bits.h" ++#include "codec_internal.h" ++#include "av1_levels.h" ++#include "vaapi_encode.h" ++ ++#define AV1_MAX_QUANT 255 ++ ++typedef struct VAAPIEncodeAV1Picture { ++ int64_t last_idr_frame; ++ int slot; ++} VAAPIEncodeAV1Picture; ++ ++typedef struct VAAPIEncodeAV1Context { ++ VAAPIEncodeContext common; ++ AV1RawOBU sh; /**< sequence header.*/ ++ AV1RawOBU fh; /**< frame header.*/ ++ CodedBitstreamContext *cbc; ++ CodedBitstreamFragment current_obu; ++ VAConfigAttribValEncAV1 attr; ++ VAConfigAttribValEncAV1Ext1 attr_ext1; ++ VAConfigAttribValEncAV1Ext2 attr_ext2; ++ ++ char sh_data[MAX_PARAM_BUFFER_SIZE]; /**< coded sequence header data. */ ++ size_t sh_data_len; /**< bit length of sh_data. */ ++ char fh_data[MAX_PARAM_BUFFER_SIZE]; /**< coded frame header data. */ ++ size_t fh_data_len; /**< bit length of fh_data. */ ++ ++ uint8_t uniform_tile; ++ uint8_t use_128x128_superblock; ++ int sb_cols; ++ int sb_rows; ++ int tile_cols_log2; ++ int tile_rows_log2; ++ int max_tile_width_sb; ++ int max_tile_height_sb; ++ uint8_t width_in_sbs_minus_1[AV1_MAX_TILE_COLS]; ++ uint8_t height_in_sbs_minus_1[AV1_MAX_TILE_ROWS]; ++ ++ int min_log2_tile_cols; ++ int max_log2_tile_cols; ++ int min_log2_tile_rows; ++ int max_log2_tile_rows; ++ ++ int q_idx_idr; ++ int q_idx_p; ++ int q_idx_b; ++ ++ /** bit positions in current frame header */ ++ int qindex_offset; ++ int loopfilter_offset; ++ int cdef_start_offset; ++ int cdef_param_size; ++ ++ /** user options */ ++ int profile; ++ int level; ++ int tier; ++ int tile_cols, tile_rows; ++ int tile_groups; ++} VAAPIEncodeAV1Context; ++ ++static void vaapi_encode_av1_trace_write_log(void *ctx, ++ PutBitContext *pbc, int length, ++ const char *str, const int *subscripts, ++ int64_t value) ++{ ++ VAAPIEncodeAV1Context *priv = ctx; ++ int position; ++ ++ position = put_bits_count(pbc); ++ av_assert0(position >= length); ++ ++ if (!strcmp(str, "base_q_idx")) ++ priv->qindex_offset = position - length; ++ else if (!strcmp(str, "loop_filter_level[0]")) ++ priv->loopfilter_offset = position - length; ++ else if (!strcmp(str, "cdef_damping_minus_3")) ++ priv->cdef_start_offset = position - length; ++ else if (!strcmp(str, "cdef_uv_sec_strength[i]")) ++ priv->cdef_param_size = position - priv->cdef_start_offset; ++} ++ ++static av_cold int vaapi_encode_av1_get_encoder_caps(AVCodecContext *avctx) ++{ ++ VAAPIEncodeContext *ctx = avctx->priv_data; ++ VAAPIEncodeAV1Context *priv = avctx->priv_data; ++ ++ // Surfaces must be aligned to superblock boundaries. ++ ctx->surface_width = FFALIGN(avctx->width, priv->use_128x128_superblock ? 128 : 64); ++ ctx->surface_height = FFALIGN(avctx->height, priv->use_128x128_superblock ? 128 : 64); ++ ++ return 0; ++} ++ ++static av_cold int vaapi_encode_av1_configure(AVCodecContext *avctx) ++{ ++ VAAPIEncodeContext *ctx = avctx->priv_data; ++ VAAPIEncodeAV1Context *priv = avctx->priv_data; ++ int ret; ++ ++ ret = ff_cbs_init(&priv->cbc, AV_CODEC_ID_AV1, avctx); ++ if (ret < 0) ++ return ret; ++ priv->cbc->trace_enable = 1; ++ priv->cbc->trace_level = AV_LOG_DEBUG; ++ priv->cbc->trace_context = ctx; ++ priv->cbc->trace_write_callback = vaapi_encode_av1_trace_write_log; ++ ++ if (ctx->rc_mode->quality) { ++ priv->q_idx_p = av_clip(ctx->rc_quality, 0, AV1_MAX_QUANT); ++ if (fabs(avctx->i_quant_factor) > 0.0) ++ priv->q_idx_idr = ++ av_clip((fabs(avctx->i_quant_factor) * priv->q_idx_p + ++ avctx->i_quant_offset) + 0.5, ++ 0, AV1_MAX_QUANT); ++ else ++ priv->q_idx_idr = priv->q_idx_p; ++ ++ if (fabs(avctx->b_quant_factor) > 0.0) ++ priv->q_idx_b = ++ av_clip((fabs(avctx->b_quant_factor) * priv->q_idx_p + ++ avctx->b_quant_offset) + 0.5, ++ 0, AV1_MAX_QUANT); ++ else ++ priv->q_idx_b = priv->q_idx_p; ++ } else { ++ /** Arbitrary value */ ++ priv->q_idx_idr = priv->q_idx_p = priv->q_idx_b = 128; ++ } ++ ++ return 0; ++} ++ ++static int vaapi_encode_av1_add_obu(AVCodecContext *avctx, ++ CodedBitstreamFragment *au, ++ uint8_t type, ++ void *obu_unit) ++{ ++ int ret; ++ ++ ret = ff_cbs_insert_unit_content(au, -1, ++ type, obu_unit, NULL); ++ if (ret < 0) { ++ av_log(avctx, AV_LOG_ERROR, "Failed to add OBU unit: " ++ "type = %d.\n", type); ++ return ret; ++ } ++ ++ return 0; ++} ++ ++static int vaapi_encode_av1_write_obu(AVCodecContext *avctx, ++ char *data, size_t *data_len, ++ CodedBitstreamFragment *bs) ++{ ++ VAAPIEncodeAV1Context *priv = avctx->priv_data; ++ int ret; ++ ++ ret = ff_cbs_write_fragment_data(priv->cbc, bs); ++ if (ret < 0) { ++ av_log(avctx, AV_LOG_ERROR, "Failed to write packed header.\n"); ++ return ret; ++ } ++ ++ if ((size_t)8 * MAX_PARAM_BUFFER_SIZE < 8 * bs->data_size - bs->data_bit_padding) { ++ av_log(avctx, AV_LOG_ERROR, "Access unit too large: " ++ "%zu < %zu.\n", (size_t)8 * MAX_PARAM_BUFFER_SIZE, ++ 8 * bs->data_size - bs->data_bit_padding); ++ return AVERROR(ENOSPC); ++ } ++ ++ memcpy(data, bs->data, bs->data_size); ++ *data_len = 8 * bs->data_size - bs->data_bit_padding; ++ ++ return 0; ++} ++ ++static int tile_log2(int blkSize, int target) { ++ int k; ++ for (k = 0; (blkSize << k) < target; k++); ++ return k; ++} ++ ++static int vaapi_encode_av1_set_tile(AVCodecContext *avctx) ++{ ++ VAAPIEncodeAV1Context *priv = avctx->priv_data; ++ int mi_cols, mi_rows, sb_shift, sb_size; ++ int max_tile_area_sb, max_tile_area_sb_varied; ++ int tile_width_sb, tile_height_sb, widest_tile_sb; ++ int tile_cols, tile_rows; ++ int min_log2_tiles; ++ int i; ++ ++ if (priv->tile_cols > AV1_MAX_TILE_COLS || ++ priv->tile_rows > AV1_MAX_TILE_ROWS) { ++ av_log(avctx, AV_LOG_ERROR, "Invalid tile number %dx%d, should less than %dx%d.\n", ++ priv->tile_cols, priv->tile_rows, AV1_MAX_TILE_COLS, AV1_MAX_TILE_ROWS); ++ return AVERROR(EINVAL); ++ } ++ ++ mi_cols = 2 * ((avctx->width + 7) >> 3); ++ mi_rows = 2 * ((avctx->height + 7) >> 3); ++ priv->sb_cols = priv->use_128x128_superblock ? ++ ((mi_cols + 31) >> 5) : ((mi_cols + 15) >> 4); ++ priv->sb_rows = priv->use_128x128_superblock ? ++ ((mi_rows + 31) >> 5) : ((mi_rows + 15) >> 4); ++ sb_shift = priv->use_128x128_superblock ? 5 : 4; ++ sb_size = sb_shift + 2; ++ priv->max_tile_width_sb = AV1_MAX_TILE_WIDTH >> sb_size; ++ max_tile_area_sb = AV1_MAX_TILE_AREA >> (2 * sb_size); ++ ++ priv->min_log2_tile_cols = tile_log2(priv->max_tile_width_sb, priv->sb_cols); ++ priv->max_log2_tile_cols = tile_log2(1, FFMIN(priv->sb_cols, AV1_MAX_TILE_COLS)); ++ priv->max_log2_tile_rows = tile_log2(1, FFMIN(priv->sb_rows, AV1_MAX_TILE_ROWS)); ++ min_log2_tiles = FFMAX(priv->min_log2_tile_cols, ++ tile_log2(max_tile_area_sb, priv->sb_rows * priv->sb_cols)); ++ ++ tile_cols = av_clip(priv->tile_cols, (priv->sb_cols + priv->max_tile_width_sb - 1) / priv->max_tile_width_sb, priv->sb_cols); ++ ++ if (!priv->tile_cols) ++ priv->tile_cols = tile_cols; ++ else if (priv->tile_cols != tile_cols){ ++ av_log(avctx, AV_LOG_ERROR, "Invalid tile cols %d, should be in range of %d~%d\n", ++ priv->tile_cols, ++ (priv->sb_cols + priv->max_tile_width_sb - 1) / priv->max_tile_width_sb, ++ priv->sb_cols); ++ return AVERROR(EINVAL); ++ } ++ ++ priv->tile_cols_log2 = tile_log2(1, priv->tile_cols); ++ tile_width_sb = (priv->sb_cols + (1 << priv->tile_cols_log2) - 1) >> ++ priv->tile_cols_log2; ++ ++ if (priv->tile_rows > priv->sb_rows) { ++ av_log(avctx, AV_LOG_ERROR, "Invalid tile rows %d, should be less than %d.\n", ++ priv->tile_rows, priv->sb_rows); ++ return AVERROR(EINVAL); ++ } ++ ++ /** Try user setting tile rows number first. */ ++ tile_rows = priv->tile_rows ? priv->tile_rows : 1; ++ for (; tile_rows <= priv->sb_rows && tile_rows <= AV1_MAX_TILE_ROWS; tile_rows++) { ++ /** try uniformed tile. */ ++ priv->tile_rows_log2 = tile_log2(1, tile_rows); ++ if ((priv->sb_cols + tile_width_sb - 1) / tile_width_sb == priv->tile_cols) { ++ for (i = 0; i < priv->tile_cols - 1; i++) ++ priv->width_in_sbs_minus_1[i] = tile_width_sb - 1; ++ priv->width_in_sbs_minus_1[i] = priv->sb_cols - (priv->tile_cols - 1) * tile_width_sb - 1; ++ ++ tile_height_sb = (priv->sb_rows + (1 << priv->tile_rows_log2) - 1) >> ++ priv->tile_rows_log2; ++ ++ if ((priv->sb_rows + tile_height_sb - 1) / tile_height_sb == tile_rows && ++ tile_height_sb <= max_tile_area_sb / tile_width_sb) { ++ for (i = 0; i < tile_rows - 1; i++) ++ priv->height_in_sbs_minus_1[i] = tile_height_sb - 1; ++ priv->height_in_sbs_minus_1[i] = priv->sb_rows - (tile_rows - 1) * tile_height_sb - 1; ++ ++ priv->uniform_tile = 1; ++ priv->min_log2_tile_rows = FFMAX(min_log2_tiles - priv->tile_cols_log2, 0); ++ ++ break; ++ } ++ } ++ ++ /** try non-uniformed tile. */ ++ widest_tile_sb = 0; ++ for (i = 0; i < priv->tile_cols; i++) { ++ priv->width_in_sbs_minus_1[i] = (i + 1) * priv->sb_cols / priv->tile_cols - i * priv->sb_cols / priv->tile_cols - 1; ++ widest_tile_sb = FFMAX(widest_tile_sb, priv->width_in_sbs_minus_1[i] + 1); ++ } ++ ++ if (min_log2_tiles) ++ max_tile_area_sb_varied = (priv->sb_rows * priv->sb_cols) >> (min_log2_tiles + 1); ++ else ++ max_tile_area_sb_varied = priv->sb_rows * priv->sb_cols; ++ priv->max_tile_height_sb = FFMAX(1, max_tile_area_sb_varied / widest_tile_sb); ++ ++ if (tile_rows == av_clip(tile_rows, (priv->sb_rows + priv->max_tile_height_sb - 1) / priv->max_tile_height_sb, priv->sb_rows)) { ++ for (i = 0; i < tile_rows; i++) ++ priv->height_in_sbs_minus_1[i] = (i + 1) * priv->sb_rows / tile_rows - i * priv->sb_rows / tile_rows - 1; ++ ++ break; ++ } ++ ++ /** Return invalid parameter if explicit tile rows is set. */ ++ if (priv->tile_rows) { ++ av_log(avctx, AV_LOG_ERROR, "Invalid tile rows %d.\n", priv->tile_rows); ++ return AVERROR(EINVAL); ++ } ++ } ++ ++ priv->tile_rows = tile_rows; ++ av_log(avctx, AV_LOG_DEBUG, "Setting tile cols/rows to %d/%d.\n", ++ priv->tile_cols, priv->tile_rows); ++ ++ /** check if tile cols/rows is supported by driver. */ ++ if (priv->attr_ext2.bits.max_tile_num_minus1) { ++ if ((priv->tile_cols * priv->tile_rows - 1) > priv->attr_ext2.bits.max_tile_num_minus1) { ++ av_log(avctx, AV_LOG_ERROR, "Unsupported tile num %d * %d = %d by driver, " ++ "should be at most %d.\n", priv->tile_cols, priv->tile_rows, ++ priv->tile_cols * priv->tile_rows, ++ priv->attr_ext2.bits.max_tile_num_minus1 + 1); ++ return AVERROR(EINVAL); ++ } ++ } ++ ++ /** check if tile group numbers is valid. */ ++ if (priv->tile_groups > priv->tile_cols * priv->tile_rows) { ++ av_log(avctx, AV_LOG_WARNING, "Invalid tile groups number %d, " ++ "correct to %d.\n", priv->tile_groups, priv->tile_cols * priv->tile_rows); ++ priv->tile_groups = priv->tile_cols * priv->tile_rows; ++ } ++ ++ return 0; ++} ++ ++static int vaapi_encode_av1_write_sequence_header(AVCodecContext *avctx, ++ char *data, size_t *data_len) ++{ ++ VAAPIEncodeAV1Context *priv = avctx->priv_data; ++ ++ memcpy(data, &priv->sh_data, MAX_PARAM_BUFFER_SIZE * sizeof(char)); ++ *data_len = priv->sh_data_len; ++ ++ return 0; ++} ++ ++static int vaapi_encode_av1_init_sequence_params(AVCodecContext *avctx) ++{ ++ VAAPIEncodeContext *ctx = avctx->priv_data; ++ VAAPIEncodeAV1Context *priv = avctx->priv_data; ++ AV1RawOBU *sh_obu = &priv->sh; ++ AV1RawSequenceHeader *sh = &sh_obu->obu.sequence_header; ++ VAEncSequenceParameterBufferAV1 *vseq = ctx->codec_sequence_params; ++ CodedBitstreamFragment *obu = &priv->current_obu; ++ const AVPixFmtDescriptor *desc; ++ int ret; ++ ++ memset(sh_obu, 0, sizeof(*sh_obu)); ++ sh_obu->header.obu_type = AV1_OBU_SEQUENCE_HEADER; ++ ++ desc = av_pix_fmt_desc_get(priv->common.input_frames->sw_format); ++ av_assert0(desc); ++ ++ sh->seq_profile = avctx->profile; ++ if (!sh->seq_force_screen_content_tools) ++ sh->seq_force_integer_mv = AV1_SELECT_INTEGER_MV; ++ sh->frame_width_bits_minus_1 = av_log2(avctx->width); ++ sh->frame_height_bits_minus_1 = av_log2(avctx->height); ++ sh->max_frame_width_minus_1 = avctx->width - 1; ++ sh->max_frame_height_minus_1 = avctx->height - 1; ++ sh->seq_tier[0] = priv->tier; ++ /** enable order hint and reserve maximum 8 bits for it by default. */ ++ sh->enable_order_hint = 1; ++ sh->order_hint_bits_minus_1 = 7; ++ ++ sh->color_config = (AV1RawColorConfig) { ++ .high_bitdepth = desc->comp[0].depth == 8 ? 0 : 1, ++ .color_primaries = avctx->color_primaries, ++ .transfer_characteristics = avctx->color_trc, ++ .matrix_coefficients = avctx->colorspace, ++ .color_description_present_flag = (avctx->color_primaries != AVCOL_PRI_UNSPECIFIED || ++ avctx->color_trc != AVCOL_TRC_UNSPECIFIED || ++ avctx->colorspace != AVCOL_SPC_UNSPECIFIED), ++ .color_range = avctx->color_range == AVCOL_RANGE_JPEG, ++ .subsampling_x = desc->log2_chroma_w, ++ .subsampling_y = desc->log2_chroma_h, ++ }; ++ ++ switch (avctx->chroma_sample_location) { ++ case AVCHROMA_LOC_LEFT: ++ sh->color_config.chroma_sample_position = AV1_CSP_VERTICAL; ++ break; ++ case AVCHROMA_LOC_TOPLEFT: ++ sh->color_config.chroma_sample_position = AV1_CSP_COLOCATED; ++ break; ++ default: ++ sh->color_config.chroma_sample_position = AV1_CSP_UNKNOWN; ++ break; ++ } ++ ++ if (avctx->level != FF_PROFILE_UNKNOWN) { ++ sh->seq_level_idx[0] = avctx->level; ++ } else { ++ const AV1LevelDescriptor *level; ++ float framerate; ++ ++ if (avctx->framerate.num > 0 && avctx->framerate.den > 0) ++ framerate = avctx->framerate.num / avctx->framerate.den; ++ else ++ framerate = 0; ++ ++ level = ff_av1_guess_level(avctx->bit_rate, priv->tier, ++ ctx->surface_width, ctx->surface_height, ++ priv->tile_rows * priv->tile_cols, ++ priv->tile_cols, framerate); ++ if (level) { ++ av_log(avctx, AV_LOG_VERBOSE, "Using level %s.\n", level->name); ++ sh->seq_level_idx[0] = level->level_idx; ++ } else { ++ av_log(avctx, AV_LOG_VERBOSE, "Stream will not conform to " ++ "any normal level, using maximum parameters level by default.\n"); ++ sh->seq_level_idx[0] = 31; ++ sh->seq_tier[0] = 1; ++ } ++ } ++ vseq->seq_profile = sh->seq_profile; ++ vseq->seq_level_idx = sh->seq_level_idx[0]; ++ vseq->seq_tier = sh->seq_tier[0]; ++ vseq->order_hint_bits_minus_1 = sh->order_hint_bits_minus_1; ++ vseq->intra_period = ctx->gop_size; ++ vseq->ip_period = ctx->b_per_p + 1; ++ ++ vseq->seq_fields.bits.enable_order_hint = sh->enable_order_hint; ++ ++ if (!(ctx->va_rc_mode & VA_RC_CQP)) { ++ vseq->bits_per_second = ctx->va_bit_rate; ++ vseq->seq_fields.bits.enable_cdef = sh->enable_cdef = 1; ++ } ++ ++ ret = vaapi_encode_av1_add_obu(avctx, obu, AV1_OBU_SEQUENCE_HEADER, &priv->sh); ++ if (ret < 0) ++ goto end; ++ ++ ret = vaapi_encode_av1_write_obu(avctx, priv->sh_data, &priv->sh_data_len, obu); ++ if (ret < 0) ++ goto end; ++ ++end: ++ ff_cbs_fragment_reset(obu); ++ return ret; ++} ++ ++static int vaapi_encode_av1_init_picture_params(AVCodecContext *avctx, ++ VAAPIEncodePicture *pic) ++{ ++ VAAPIEncodeContext *ctx = avctx->priv_data; ++ VAAPIEncodeAV1Context *priv = avctx->priv_data; ++ VAAPIEncodeAV1Picture *hpic = pic->priv_data; ++ AV1RawOBU *fh_obu = &priv->fh; ++ AV1RawFrameHeader *fh = &fh_obu->obu.frame.header; ++ VAEncPictureParameterBufferAV1 *vpic = pic->codec_picture_params; ++ CodedBitstreamFragment *obu = &priv->current_obu; ++ VAAPIEncodePicture *ref; ++ VAAPIEncodeAV1Picture *href; ++ int slot, i; ++ int ret; ++ static const int8_t default_loop_filter_ref_deltas[AV1_TOTAL_REFS_PER_FRAME] = ++ { 1, 0, 0, 0, -1, 0, -1, -1 }; ++ ++ memset(fh_obu, 0, sizeof(*fh_obu)); ++ pic->nb_slices = priv->tile_groups; ++ pic->non_independent_frame = pic->encode_order < pic->display_order; ++ fh_obu->header.obu_type = AV1_OBU_FRAME_HEADER; ++ fh_obu->header.obu_has_size_field = 1; ++ ++ switch (pic->type) { ++ case PICTURE_TYPE_IDR: ++ av_assert0(pic->nb_refs[0] == 0 || pic->nb_refs[1]); ++ fh->frame_type = AV1_FRAME_KEY; ++ fh->refresh_frame_flags = 0xFF; ++ fh->base_q_idx = priv->q_idx_idr; ++ hpic->slot = 0; ++ hpic->last_idr_frame = pic->display_order; ++ break; ++ case PICTURE_TYPE_P: ++ av_assert0(pic->nb_refs[0]); ++ fh->frame_type = AV1_FRAME_INTER; ++ fh->base_q_idx = priv->q_idx_p; ++ ref = pic->refs[0][pic->nb_refs[0] - 1]; ++ href = ref->priv_data; ++ hpic->slot = !href->slot; ++ hpic->last_idr_frame = href->last_idr_frame; ++ fh->refresh_frame_flags = 1 << hpic->slot; ++ ++ /** set the nearest frame in L0 as all reference frame. */ ++ for (i = 0; i < AV1_REFS_PER_FRAME; i++) { ++ fh->ref_frame_idx[i] = href->slot; ++ } ++ fh->primary_ref_frame = href->slot; ++ fh->ref_order_hint[href->slot] = ref->display_order - href->last_idr_frame; ++ vpic->ref_frame_ctrl_l0.fields.search_idx0 = AV1_REF_FRAME_LAST; ++ ++ /** set the 2nd nearest frame in L0 as Golden frame. */ ++ if (pic->nb_refs[0] > 1) { ++ ref = pic->refs[0][pic->nb_refs[0] - 2]; ++ href = ref->priv_data; ++ fh->ref_frame_idx[3] = href->slot; ++ fh->ref_order_hint[href->slot] = ref->display_order - href->last_idr_frame; ++ vpic->ref_frame_ctrl_l0.fields.search_idx1 = AV1_REF_FRAME_GOLDEN; ++ } ++ break; ++ case PICTURE_TYPE_B: ++ av_assert0(pic->nb_refs[0] && pic->nb_refs[1]); ++ fh->frame_type = AV1_FRAME_INTER; ++ fh->base_q_idx = priv->q_idx_b; ++ fh->refresh_frame_flags = 0x0; ++ fh->reference_select = 1; ++ ++ /** B frame will not be referenced, disable its recon frame. */ ++ vpic->picture_flags.bits.disable_frame_recon = 1; ++ ++ /** Use LAST_FRAME and BWDREF_FRAME for reference. */ ++ vpic->ref_frame_ctrl_l0.fields.search_idx0 = AV1_REF_FRAME_LAST; ++ vpic->ref_frame_ctrl_l1.fields.search_idx0 = AV1_REF_FRAME_BWDREF; ++ ++ ref = pic->refs[0][pic->nb_refs[0] - 1]; ++ href = ref->priv_data; ++ hpic->last_idr_frame = href->last_idr_frame; ++ fh->primary_ref_frame = href->slot; ++ fh->ref_order_hint[href->slot] = ref->display_order - href->last_idr_frame; ++ for (i = 0; i < AV1_REF_FRAME_GOLDEN; i++) { ++ fh->ref_frame_idx[i] = href->slot; ++ } ++ ++ ref = pic->refs[1][pic->nb_refs[1] - 1]; ++ href = ref->priv_data; ++ fh->ref_order_hint[href->slot] = ref->display_order - href->last_idr_frame; ++ for (i = AV1_REF_FRAME_GOLDEN; i < AV1_REFS_PER_FRAME; i++) { ++ fh->ref_frame_idx[i] = href->slot; ++ } ++ break; ++ default: ++ av_assert0(0 && "invalid picture type"); ++ } ++ ++ fh->show_frame = pic->display_order <= pic->encode_order; ++ fh->showable_frame = fh->frame_type != AV1_FRAME_KEY; ++ fh->frame_width_minus_1 = avctx->width - 1; ++ fh->frame_height_minus_1 = avctx->height - 1; ++ fh->render_width_minus_1 = fh->frame_width_minus_1; ++ fh->render_height_minus_1 = fh->frame_height_minus_1; ++ fh->order_hint = pic->display_order - hpic->last_idr_frame; ++ fh->tile_cols = priv->tile_cols; ++ fh->tile_rows = priv->tile_rows; ++ fh->tile_cols_log2 = priv->tile_cols_log2; ++ fh->tile_rows_log2 = priv->tile_rows_log2; ++ fh->uniform_tile_spacing_flag = priv->uniform_tile; ++ fh->tile_size_bytes_minus1 = priv->attr_ext2.bits.tile_size_bytes_minus1; ++ ++ /** ignore ONLY_4x4 mode for codedlossless is not fully implemented. */ ++ if (priv->attr_ext2.bits.tx_mode_support & 0x04) ++ fh->tx_mode = AV1_TX_MODE_SELECT; ++ else if (priv->attr_ext2.bits.tx_mode_support & 0x02) ++ fh->tx_mode = AV1_TX_MODE_LARGEST; ++ else { ++ av_log(avctx, AV_LOG_ERROR, "No available tx mode found.\n"); ++ return AVERROR(EINVAL); ++ } ++ ++ for (i = 0; i < fh->tile_cols; i++) ++ fh->width_in_sbs_minus_1[i] = vpic->width_in_sbs_minus_1[i] = priv->width_in_sbs_minus_1[i]; ++ ++ for (i = 0; i < fh->tile_rows; i++) ++ fh->height_in_sbs_minus_1[i] = vpic->height_in_sbs_minus_1[i] = priv->height_in_sbs_minus_1[i]; ++ ++ memcpy(fh->loop_filter_ref_deltas, default_loop_filter_ref_deltas, ++ AV1_TOTAL_REFS_PER_FRAME * sizeof(int8_t)); ++ ++ if (fh->frame_type == AV1_FRAME_KEY && fh->show_frame) { ++ fh->error_resilient_mode = 1; ++ } ++ ++ if (fh->frame_type == AV1_FRAME_KEY || fh->error_resilient_mode) ++ fh->primary_ref_frame = AV1_PRIMARY_REF_NONE; ++ ++ vpic->base_qindex = fh->base_q_idx; ++ vpic->frame_width_minus_1 = fh->frame_width_minus_1; ++ vpic->frame_height_minus_1 = fh->frame_height_minus_1; ++ vpic->primary_ref_frame = fh->primary_ref_frame; ++ vpic->reconstructed_frame = pic->recon_surface; ++ vpic->coded_buf = pic->output_buffer; ++ vpic->tile_cols = fh->tile_cols; ++ vpic->tile_rows = fh->tile_rows; ++ vpic->order_hint = fh->order_hint; ++#if VA_CHECK_VERSION(1, 15, 0) ++ vpic->refresh_frame_flags = fh->refresh_frame_flags; ++#endif ++ ++ vpic->picture_flags.bits.enable_frame_obu = 0; ++ vpic->picture_flags.bits.frame_type = fh->frame_type; ++ vpic->picture_flags.bits.reduced_tx_set = fh->reduced_tx_set; ++ vpic->picture_flags.bits.error_resilient_mode = fh->error_resilient_mode; ++ ++ /** let driver decide to use single or compound reference prediction mode. */ ++ vpic->mode_control_flags.bits.reference_mode = fh->reference_select ? 2 : 0; ++ vpic->mode_control_flags.bits.tx_mode = fh->tx_mode; ++ ++ vpic->tile_group_obu_hdr_info.bits.obu_has_size_field = 1; ++ ++ /** set reference. */ ++ for (i = 0; i < AV1_REFS_PER_FRAME; i++) ++ vpic->ref_frame_idx[i] = fh->ref_frame_idx[i]; ++ ++ for (i = 0; i < FF_ARRAY_ELEMS(vpic->reference_frames); i++) ++ vpic->reference_frames[i] = VA_INVALID_SURFACE; ++ ++ for (i = 0; i < MAX_REFERENCE_LIST_NUM; i++) { ++ for (int j = 0; j < pic->nb_refs[i]; j++) { ++ VAAPIEncodePicture *ref_pic = pic->refs[i][j]; ++ ++ slot = ((VAAPIEncodeAV1Picture*)ref_pic->priv_data)->slot; ++ av_assert0(vpic->reference_frames[slot] == VA_INVALID_SURFACE); ++ ++ vpic->reference_frames[slot] = ref_pic->recon_surface; ++ } ++ } ++ ++ fh_obu->obu_size_byte_len = priv->attr_ext2.bits.obu_size_bytes_minus1 + 1; ++ ret = vaapi_encode_av1_add_obu(avctx, obu, AV1_OBU_FRAME_HEADER, &priv->fh); ++ if (ret < 0) ++ goto end; ++ ++ ret = vaapi_encode_av1_write_obu(avctx, priv->fh_data, &priv->fh_data_len, obu); ++ if (ret < 0) ++ goto end; ++ ++ if (!(ctx->va_rc_mode & VA_RC_CQP)) { ++ vpic->min_base_qindex = av_clip(avctx->qmin, 1, AV1_MAX_QUANT); ++ vpic->max_base_qindex = av_clip(avctx->qmax, 1, AV1_MAX_QUANT); ++ ++ vpic->bit_offset_qindex = priv->qindex_offset; ++ vpic->bit_offset_loopfilter_params = priv->loopfilter_offset; ++ vpic->bit_offset_cdef_params = priv->cdef_start_offset; ++ vpic->size_in_bits_cdef_params = priv->cdef_param_size; ++ vpic->size_in_bits_frame_hdr_obu = priv->fh_data_len; ++ vpic->byte_offset_frame_hdr_obu_size = (((pic->type == PICTURE_TYPE_IDR) ? ++ priv->sh_data_len / 8 : 0) + ++ (fh_obu->header.obu_extension_flag ? ++ 2 : 1)); ++ } ++ ++end: ++ ff_cbs_fragment_reset(obu); ++ return ret; ++} ++ ++static int vaapi_encode_av1_init_slice_params(AVCodecContext *avctx, ++ VAAPIEncodePicture *pic, ++ VAAPIEncodeSlice *slice) ++{ ++ VAAPIEncodeAV1Context *priv = avctx->priv_data; ++ VAEncTileGroupBufferAV1 *vslice = slice->codec_slice_params; ++ CodedBitstreamAV1Context *cbctx = priv->cbc->priv_data; ++ int div; ++ ++ /** Set tile group info. */ ++ div = priv->tile_cols * priv->tile_rows / priv->tile_groups; ++ vslice->tg_start = slice->index * div; ++ if (slice->index == (priv->tile_groups - 1)) { ++ vslice->tg_end = priv->tile_cols * priv->tile_rows - 1; ++ cbctx->seen_frame_header = 0; ++ } else { ++ vslice->tg_end = (slice->index + 1) * div - 1; ++ } ++ ++ return 0; ++} ++ ++static int vaapi_encode_av1_write_picture_header(AVCodecContext *avctx, ++ VAAPIEncodePicture *pic, ++ char *data, size_t *data_len) ++{ ++ VAAPIEncodeAV1Context *priv = avctx->priv_data; ++ CodedBitstreamFragment *obu = &priv->current_obu; ++ CodedBitstreamAV1Context *cbctx = priv->cbc->priv_data; ++ AV1RawOBU *fh_obu = &priv->fh; ++ AV1RawFrameHeader *rep_fh = &fh_obu->obu.frame_header; ++ VAAPIEncodeAV1Picture *href; ++ int ret = 0; ++ ++ pic->tail_size = 0; ++ /** Pack repeat frame header. */ ++ if (pic->display_order > pic->encode_order) { ++ memset(fh_obu, 0, sizeof(*fh_obu)); ++ href = pic->refs[0][pic->nb_refs[0] - 1]->priv_data; ++ fh_obu->header.obu_type = AV1_OBU_FRAME_HEADER; ++ fh_obu->header.obu_has_size_field = 1; ++ ++ rep_fh->show_existing_frame = 1; ++ rep_fh->frame_to_show_map_idx = href->slot == 0; ++ rep_fh->frame_type = AV1_FRAME_INTER; ++ rep_fh->frame_width_minus_1 = avctx->width - 1; ++ rep_fh->frame_height_minus_1 = avctx->height - 1; ++ rep_fh->render_width_minus_1 = rep_fh->frame_width_minus_1; ++ rep_fh->render_height_minus_1 = rep_fh->frame_height_minus_1; ++ ++ cbctx->seen_frame_header = 0; ++ ++ ret = vaapi_encode_av1_add_obu(avctx, obu, AV1_OBU_FRAME_HEADER, &priv->fh); ++ if (ret < 0) ++ goto end; ++ ++ ret = vaapi_encode_av1_write_obu(avctx, pic->tail_data, &pic->tail_size, obu); ++ if (ret < 0) ++ goto end; ++ ++ pic->tail_size /= 8; ++ } ++ ++ memcpy(data, &priv->fh_data, MAX_PARAM_BUFFER_SIZE * sizeof(char)); ++ *data_len = priv->fh_data_len; ++ ++end: ++ ff_cbs_fragment_reset(obu); ++ return ret; ++} ++ ++static const VAAPIEncodeProfile vaapi_encode_av1_profiles[] = { ++ { FF_PROFILE_AV1_MAIN, 8, 3, 1, 1, VAProfileAV1Profile0 }, ++ { FF_PROFILE_AV1_MAIN, 10, 3, 1, 1, VAProfileAV1Profile0 }, ++ { FF_PROFILE_UNKNOWN } ++}; ++ ++static const VAAPIEncodeType vaapi_encode_type_av1 = { ++ .profiles = vaapi_encode_av1_profiles, ++ .flags = FLAG_B_PICTURES | FLAG_TIMESTAMP_NO_DELAY, ++ .default_quality = 25, ++ ++ .get_encoder_caps = &vaapi_encode_av1_get_encoder_caps, ++ .configure = &vaapi_encode_av1_configure, ++ ++ .sequence_header_type = VAEncPackedHeaderSequence, ++ .sequence_params_size = sizeof(VAEncSequenceParameterBufferAV1), ++ .init_sequence_params = &vaapi_encode_av1_init_sequence_params, ++ .write_sequence_header = &vaapi_encode_av1_write_sequence_header, ++ ++ .picture_priv_data_size = sizeof(VAAPIEncodeAV1Picture), ++ .picture_header_type = VAEncPackedHeaderPicture, ++ .picture_params_size = sizeof(VAEncPictureParameterBufferAV1), ++ .init_picture_params = &vaapi_encode_av1_init_picture_params, ++ .write_picture_header = &vaapi_encode_av1_write_picture_header, ++ ++ .slice_params_size = sizeof(VAEncTileGroupBufferAV1), ++ .init_slice_params = &vaapi_encode_av1_init_slice_params, ++}; ++ ++static av_cold int vaapi_encode_av1_init(AVCodecContext *avctx) ++{ ++ VAAPIEncodeContext *ctx = avctx->priv_data; ++ VAAPIEncodeAV1Context *priv = avctx->priv_data; ++ VAConfigAttrib attr; ++ VAStatus vas; ++ int ret; ++ ++ ctx->codec = &vaapi_encode_type_av1; ++ ++ ctx->desired_packed_headers = ++ VA_ENC_PACKED_HEADER_SEQUENCE | ++ VA_ENC_PACKED_HEADER_PICTURE; ++ ++ if (avctx->profile == FF_PROFILE_UNKNOWN) ++ avctx->profile = priv->profile; ++ if (avctx->level == FF_PROFILE_UNKNOWN) ++ avctx->level = priv->level; ++ ++ if (avctx->level != FF_PROFILE_UNKNOWN && avctx->level & ~0x1f) { ++ av_log(avctx, AV_LOG_ERROR, "Invalid level %d\n", avctx->level); ++ return AVERROR(EINVAL); ++ } ++ ++ ret = ff_vaapi_encode_init(avctx); ++ if (ret < 0) ++ return ret; ++ ++ attr.type = VAConfigAttribEncAV1; ++ vas = vaGetConfigAttributes(ctx->hwctx->display, ++ ctx->va_profile, ++ ctx->va_entrypoint, ++ &attr, 1); ++ if (vas != VA_STATUS_SUCCESS) { ++ av_log(avctx, AV_LOG_ERROR, "Failed to query " ++ "config attribute: %d (%s).\n", vas, vaErrorStr(vas)); ++ return AVERROR_EXTERNAL; ++ } else if (attr.value == VA_ATTRIB_NOT_SUPPORTED) { ++ priv->attr.value = 0; ++ av_log(avctx, AV_LOG_WARNING, "Attribute type:%d is not " ++ "supported.\n", attr.type); ++ } else { ++ priv->attr.value = attr.value; ++ } ++ ++ attr.type = VAConfigAttribEncAV1Ext1; ++ vas = vaGetConfigAttributes(ctx->hwctx->display, ++ ctx->va_profile, ++ ctx->va_entrypoint, ++ &attr, 1); ++ if (vas != VA_STATUS_SUCCESS) { ++ av_log(avctx, AV_LOG_ERROR, "Failed to query " ++ "config attribute: %d (%s).\n", vas, vaErrorStr(vas)); ++ return AVERROR_EXTERNAL; ++ } else if (attr.value == VA_ATTRIB_NOT_SUPPORTED) { ++ priv->attr_ext1.value = 0; ++ av_log(avctx, AV_LOG_WARNING, "Attribute type:%d is not " ++ "supported.\n", attr.type); ++ } else { ++ priv->attr_ext1.value = attr.value; ++ } ++ ++ /** This attr provides essential indicators, return error if not support. */ ++ attr.type = VAConfigAttribEncAV1Ext2; ++ vas = vaGetConfigAttributes(ctx->hwctx->display, ++ ctx->va_profile, ++ ctx->va_entrypoint, ++ &attr, 1); ++ if (vas != VA_STATUS_SUCCESS || attr.value == VA_ATTRIB_NOT_SUPPORTED) { ++ av_log(avctx, AV_LOG_ERROR, "Failed to query " ++ "config attribute: %d (%s).\n", vas, vaErrorStr(vas)); ++ return AVERROR_EXTERNAL; ++ } else { ++ priv->attr_ext2.value = attr.value; ++ } ++ ++ ret = vaapi_encode_av1_set_tile(avctx); ++ if (ret < 0) ++ return ret; ++ ++ return 0; ++} ++ ++static av_cold int vaapi_encode_av1_close(AVCodecContext *avctx) ++{ ++ VAAPIEncodeAV1Context *priv = avctx->priv_data; ++ ++ ff_cbs_fragment_free(&priv->current_obu); ++ ff_cbs_close(&priv->cbc); ++ ++ return ff_vaapi_encode_close(avctx); ++} ++ ++#define OFFSET(x) offsetof(VAAPIEncodeAV1Context, x) ++#define FLAGS (AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM) ++ ++static const AVOption vaapi_encode_av1_options[] = { ++ VAAPI_ENCODE_COMMON_OPTIONS, ++ VAAPI_ENCODE_RC_OPTIONS, ++ { "profile", "Set profile (seq_profile)", ++ OFFSET(profile), AV_OPT_TYPE_INT, ++ { .i64 = FF_PROFILE_UNKNOWN }, FF_PROFILE_UNKNOWN, 0xff, FLAGS, "profile" }, ++ ++#define PROFILE(name, value) name, NULL, 0, AV_OPT_TYPE_CONST, \ ++ { .i64 = value }, 0, 0, FLAGS, "profile" ++ { PROFILE("main", FF_PROFILE_AV1_MAIN) }, ++ { PROFILE("high", FF_PROFILE_AV1_HIGH) }, ++ { PROFILE("professional", FF_PROFILE_AV1_PROFESSIONAL) }, ++#undef PROFILE ++ ++ { "tier", "Set tier (seq_tier)", ++ OFFSET(tier), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, FLAGS, "tier" }, ++ { "main", NULL, 0, AV_OPT_TYPE_CONST, ++ { .i64 = 0 }, 0, 0, FLAGS, "tier" }, ++ { "high", NULL, 0, AV_OPT_TYPE_CONST, ++ { .i64 = 1 }, 0, 0, FLAGS, "tier" }, ++ { "level", "Set level (seq_level_idx)", ++ OFFSET(level), AV_OPT_TYPE_INT, ++ { .i64 = FF_PROFILE_UNKNOWN }, FF_PROFILE_UNKNOWN, 0x1f, FLAGS, "level" }, ++ ++#define LEVEL(name, value) name, NULL, 0, AV_OPT_TYPE_CONST, \ ++ { .i64 = value }, 0, 0, FLAGS, "level" ++ { LEVEL("2.0", 0) }, ++ { LEVEL("2.1", 1) }, ++ { LEVEL("3.0", 4) }, ++ { LEVEL("3.1", 5) }, ++ { LEVEL("4.0", 8) }, ++ { LEVEL("4.1", 9) }, ++ { LEVEL("5.0", 12) }, ++ { LEVEL("5.1", 13) }, ++ { LEVEL("5.2", 14) }, ++ { LEVEL("5.3", 15) }, ++ { LEVEL("6.0", 16) }, ++ { LEVEL("6.1", 17) }, ++ { LEVEL("6.2", 18) }, ++ { LEVEL("6.3", 19) }, ++#undef LEVEL ++ ++ { "tiles", "Tile columns x rows (Use minimal tile column/row number automatically by default)", ++ OFFSET(tile_cols), AV_OPT_TYPE_IMAGE_SIZE, { .str = NULL }, 0, 0, FLAGS }, ++ { "tile_groups", "Number of tile groups for encoding", ++ OFFSET(tile_groups), AV_OPT_TYPE_INT, { .i64 = 1 }, 1, AV1_MAX_TILE_ROWS * AV1_MAX_TILE_COLS, FLAGS }, ++ ++ { NULL }, ++}; ++ ++static const FFCodecDefault vaapi_encode_av1_defaults[] = { ++ { "b", "0" }, ++ { "bf", "2" }, ++ { "g", "120" }, ++ { "qmin", "1" }, ++ { "qmax", "255" }, ++ { NULL }, ++}; ++ ++static const AVClass vaapi_encode_av1_class = { ++ .class_name = "av1_vaapi", ++ .item_name = av_default_item_name, ++ .option = vaapi_encode_av1_options, ++ .version = LIBAVUTIL_VERSION_INT, ++}; ++ ++const FFCodec ff_av1_vaapi_encoder = { ++ .p.name = "av1_vaapi", ++ CODEC_LONG_NAME("AV1 (VAAPI)"), ++ .p.type = AVMEDIA_TYPE_VIDEO, ++ .p.id = AV_CODEC_ID_AV1, ++ .priv_data_size = sizeof(VAAPIEncodeAV1Context), ++ .init = &vaapi_encode_av1_init, ++ FF_CODEC_RECEIVE_PACKET_CB(&ff_vaapi_encode_receive_packet), ++ .close = &vaapi_encode_av1_close, ++ .p.priv_class = &vaapi_encode_av1_class, ++ .p.capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_HARDWARE | ++ AV_CODEC_CAP_DR1 | AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE, ++ .caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE | ++ FF_CODEC_CAP_INIT_CLEANUP, ++ .defaults = vaapi_encode_av1_defaults, ++ .p.pix_fmts = (const enum AVPixelFormat[]) { ++ AV_PIX_FMT_VAAPI, ++ AV_PIX_FMT_NONE, ++ }, ++ .hw_configs = ff_vaapi_encode_hw_configs, ++ .p.wrapper_name = "vaapi", ++}; +diff --git a/libavcodec/vaapi_encode_h264.c b/libavcodec/vaapi_encode_h264.c +index 645f6a9..c205d1e 100644 +--- a/libavcodec/vaapi_encode_h264.c ++++ b/libavcodec/vaapi_encode_h264.c +@@ -614,7 +614,7 @@ static int vaapi_encode_h264_init_picture_params(AVCodecContext *avctx, + VAAPIEncodePicture *prev = pic->prev; + VAAPIEncodeH264Picture *hprev = prev ? prev->priv_data : NULL; + VAEncPictureParameterBufferH264 *vpic = pic->codec_picture_params; +- int i; ++ int i, j = 0; + + if (pic->type == PICTURE_TYPE_IDR) { + av_assert0(pic->display_order == pic->encode_order); +@@ -715,24 +715,26 @@ static int vaapi_encode_h264_init_picture_params(AVCodecContext *avctx, + .TopFieldOrderCnt = hpic->pic_order_cnt, + .BottomFieldOrderCnt = hpic->pic_order_cnt, + }; +- +- for (i = 0; i < pic->nb_refs; i++) { +- VAAPIEncodePicture *ref = pic->refs[i]; +- VAAPIEncodeH264Picture *href; +- +- av_assert0(ref && ref->encode_order < pic->encode_order); +- href = ref->priv_data; +- +- vpic->ReferenceFrames[i] = (VAPictureH264) { +- .picture_id = ref->recon_surface, +- .frame_idx = href->frame_num, +- .flags = VA_PICTURE_H264_SHORT_TERM_REFERENCE, +- .TopFieldOrderCnt = href->pic_order_cnt, +- .BottomFieldOrderCnt = href->pic_order_cnt, +- }; ++ for (int k = 0; k < MAX_REFERENCE_LIST_NUM; k++) { ++ for (i = 0; i < pic->nb_refs[k]; i++) { ++ VAAPIEncodePicture *ref = pic->refs[k][i]; ++ VAAPIEncodeH264Picture *href; ++ ++ av_assert0(ref && ref->encode_order < pic->encode_order); ++ href = ref->priv_data; ++ ++ vpic->ReferenceFrames[j++] = (VAPictureH264) { ++ .picture_id = ref->recon_surface, ++ .frame_idx = href->frame_num, ++ .flags = VA_PICTURE_H264_SHORT_TERM_REFERENCE, ++ .TopFieldOrderCnt = href->pic_order_cnt, ++ .BottomFieldOrderCnt = href->pic_order_cnt, ++ }; ++ } + } +- for (; i < FF_ARRAY_ELEMS(vpic->ReferenceFrames); i++) { +- vpic->ReferenceFrames[i] = (VAPictureH264) { ++ ++ for (; j < FF_ARRAY_ELEMS(vpic->ReferenceFrames); j++) { ++ vpic->ReferenceFrames[j] = (VAPictureH264) { + .picture_id = VA_INVALID_ID, + .flags = VA_PICTURE_H264_INVALID, + }; +@@ -934,17 +936,17 @@ static int vaapi_encode_h264_init_slice_params(AVCodecContext *avctx, + + if (pic->type == PICTURE_TYPE_P) { + int need_rplm = 0; +- for (i = 0; i < pic->nb_refs; i++) { +- av_assert0(pic->refs[i]); +- if (pic->refs[i] != def_l0[i]) ++ for (i = 0; i < pic->nb_refs[0]; i++) { ++ av_assert0(pic->refs[0][i]); ++ if (pic->refs[0][i] != def_l0[i]) + need_rplm = 1; + } + + sh->ref_pic_list_modification_flag_l0 = need_rplm; + if (need_rplm) { + int pic_num = hpic->frame_num; +- for (i = 0; i < pic->nb_refs; i++) { +- href = pic->refs[i]->priv_data; ++ for (i = 0; i < pic->nb_refs[0]; i++) { ++ href = pic->refs[0][i]->priv_data; + av_assert0(href->frame_num != pic_num); + if (href->frame_num < pic_num) { + sh->rplm_l0[i].modification_of_pic_nums_idc = 0; +@@ -963,28 +965,29 @@ static int vaapi_encode_h264_init_slice_params(AVCodecContext *avctx, + } else { + int need_rplm_l0 = 0, need_rplm_l1 = 0; + int n0 = 0, n1 = 0; +- for (i = 0; i < pic->nb_refs; i++) { +- av_assert0(pic->refs[i]); +- href = pic->refs[i]->priv_data; +- av_assert0(href->pic_order_cnt != hpic->pic_order_cnt); +- if (href->pic_order_cnt < hpic->pic_order_cnt) { +- if (pic->refs[i] != def_l0[n0]) +- need_rplm_l0 = 1; +- ++n0; +- } else { +- if (pic->refs[i] != def_l1[n1]) +- need_rplm_l1 = 1; +- ++n1; +- } ++ for (i = 0; i < pic->nb_refs[0]; i++) { ++ av_assert0(pic->refs[0][i]); ++ href = pic->refs[0][i]->priv_data; ++ av_assert0(href->pic_order_cnt < hpic->pic_order_cnt); ++ if (pic->refs[0][i] != def_l0[n0]) ++ need_rplm_l0 = 1; ++ ++n0; ++ } ++ ++ for (i = 0; i < pic->nb_refs[1]; i++) { ++ av_assert0(pic->refs[1][i]); ++ href = pic->refs[1][i]->priv_data; ++ av_assert0(href->pic_order_cnt > hpic->pic_order_cnt); ++ if (pic->refs[1][i] != def_l1[n1]) ++ need_rplm_l1 = 1; ++ ++n1; + } + + sh->ref_pic_list_modification_flag_l0 = need_rplm_l0; + if (need_rplm_l0) { + int pic_num = hpic->frame_num; +- for (i = j = 0; i < pic->nb_refs; i++) { +- href = pic->refs[i]->priv_data; +- if (href->pic_order_cnt > hpic->pic_order_cnt) +- continue; ++ for (i = j = 0; i < pic->nb_refs[0]; i++) { ++ href = pic->refs[0][i]->priv_data; + av_assert0(href->frame_num != pic_num); + if (href->frame_num < pic_num) { + sh->rplm_l0[j].modification_of_pic_nums_idc = 0; +@@ -1005,10 +1008,8 @@ static int vaapi_encode_h264_init_slice_params(AVCodecContext *avctx, + sh->ref_pic_list_modification_flag_l1 = need_rplm_l1; + if (need_rplm_l1) { + int pic_num = hpic->frame_num; +- for (i = j = 0; i < pic->nb_refs; i++) { +- href = pic->refs[i]->priv_data; +- if (href->pic_order_cnt < hpic->pic_order_cnt) +- continue; ++ for (i = j = 0; i < pic->nb_refs[1]; i++) { ++ href = pic->refs[1][i]->priv_data; + av_assert0(href->frame_num != pic_num); + if (href->frame_num < pic_num) { + sh->rplm_l1[j].modification_of_pic_nums_idc = 0; +@@ -1048,14 +1049,13 @@ static int vaapi_encode_h264_init_slice_params(AVCodecContext *avctx, + vslice->RefPicList1[i].flags = VA_PICTURE_H264_INVALID; + } + +- av_assert0(pic->nb_refs <= 2); +- if (pic->nb_refs >= 1) { ++ if (pic->nb_refs[0]) { + // Backward reference for P- or B-frame. + av_assert0(pic->type == PICTURE_TYPE_P || + pic->type == PICTURE_TYPE_B); + vslice->RefPicList0[0] = vpic->ReferenceFrames[0]; + } +- if (pic->nb_refs >= 2) { ++ if (pic->nb_refs[1]) { + // Forward reference for B-frame. + av_assert0(pic->type == PICTURE_TYPE_B); + vslice->RefPicList1[0] = vpic->ReferenceFrames[1]; +diff --git a/libavcodec/vaapi_encode_h265.c b/libavcodec/vaapi_encode_h265.c +index aa7e532..f015e6f 100644 +--- a/libavcodec/vaapi_encode_h265.c ++++ b/libavcodec/vaapi_encode_h265.c +@@ -764,7 +764,7 @@ static int vaapi_encode_h265_init_picture_params(AVCodecContext *avctx, + VAAPIEncodePicture *prev = pic->prev; + VAAPIEncodeH265Picture *hprev = prev ? prev->priv_data : NULL; + VAEncPictureParameterBufferHEVC *vpic = pic->codec_picture_params; +- int i; ++ int i, j = 0; + + if (pic->type == PICTURE_TYPE_IDR) { + av_assert0(pic->display_order == pic->encode_order); +@@ -789,8 +789,8 @@ static int vaapi_encode_h265_init_picture_params(AVCodecContext *avctx, + hpic->pic_type = 1; + } else { + VAAPIEncodePicture *irap_ref; +- av_assert0(pic->refs[0] && pic->refs[1]); +- for (irap_ref = pic; irap_ref; irap_ref = irap_ref->refs[1]) { ++ av_assert0(pic->refs[0][0] && pic->refs[1][0]); ++ for (irap_ref = pic; irap_ref; irap_ref = irap_ref->refs[1][0]) { + if (irap_ref->type == PICTURE_TYPE_I) + break; + } +@@ -915,24 +915,27 @@ static int vaapi_encode_h265_init_picture_params(AVCodecContext *avctx, + .flags = 0, + }; + +- for (i = 0; i < pic->nb_refs; i++) { +- VAAPIEncodePicture *ref = pic->refs[i]; +- VAAPIEncodeH265Picture *href; +- +- av_assert0(ref && ref->encode_order < pic->encode_order); +- href = ref->priv_data; +- +- vpic->reference_frames[i] = (VAPictureHEVC) { +- .picture_id = ref->recon_surface, +- .pic_order_cnt = href->pic_order_cnt, +- .flags = (ref->display_order < pic->display_order ? +- VA_PICTURE_HEVC_RPS_ST_CURR_BEFORE : 0) | +- (ref->display_order > pic->display_order ? +- VA_PICTURE_HEVC_RPS_ST_CURR_AFTER : 0), +- }; ++ for (int k = 0; k < MAX_REFERENCE_LIST_NUM; k++) { ++ for (i = 0; i < pic->nb_refs[k]; i++) { ++ VAAPIEncodePicture *ref = pic->refs[k][i]; ++ VAAPIEncodeH265Picture *href; ++ ++ av_assert0(ref && ref->encode_order < pic->encode_order); ++ href = ref->priv_data; ++ ++ vpic->reference_frames[j++] = (VAPictureHEVC) { ++ .picture_id = ref->recon_surface, ++ .pic_order_cnt = href->pic_order_cnt, ++ .flags = (ref->display_order < pic->display_order ? ++ VA_PICTURE_HEVC_RPS_ST_CURR_BEFORE : 0) | ++ (ref->display_order > pic->display_order ? ++ VA_PICTURE_HEVC_RPS_ST_CURR_AFTER : 0), ++ }; ++ } + } +- for (; i < FF_ARRAY_ELEMS(vpic->reference_frames); i++) { +- vpic->reference_frames[i] = (VAPictureHEVC) { ++ ++ for (; j < FF_ARRAY_ELEMS(vpic->reference_frames); j++) { ++ vpic->reference_frames[j] = (VAPictureHEVC) { + .picture_id = VA_INVALID_ID, + .flags = VA_PICTURE_HEVC_INVALID, + }; +@@ -1016,21 +1019,33 @@ static int vaapi_encode_h265_init_slice_params(AVCodecContext *avctx, + memset(rps, 0, sizeof(*rps)); + + rps_pics = 0; +- for (i = 0; i < pic->nb_refs; i++) { +- strp = pic->refs[i]->priv_data; +- rps_poc[rps_pics] = strp->pic_order_cnt; +- rps_used[rps_pics] = 1; +- ++rps_pics; ++ for (i = 0; i < MAX_REFERENCE_LIST_NUM; i++) { ++ for (j = 0; j < pic->nb_refs[i]; j++) { ++ strp = pic->refs[i][j]->priv_data; ++ rps_poc[rps_pics] = strp->pic_order_cnt; ++ rps_used[rps_pics] = 1; ++ ++rps_pics; ++ } + } ++ + for (i = 0; i < pic->nb_dpb_pics; i++) { + if (pic->dpb[i] == pic) + continue; +- for (j = 0; j < pic->nb_refs; j++) { +- if (pic->dpb[i] == pic->refs[j]) ++ ++ for (j = 0; j < pic->nb_refs[0]; j++) { ++ if (pic->dpb[i] == pic->refs[0][j]) ++ break; ++ } ++ if (j < pic->nb_refs[0]) ++ continue; ++ ++ for (j = 0; j < pic->nb_refs[1]; j++) { ++ if (pic->dpb[i] == pic->refs[1][j]) + break; + } +- if (j < pic->nb_refs) ++ if (j < pic->nb_refs[1]) + continue; ++ + strp = pic->dpb[i]->priv_data; + rps_poc[rps_pics] = strp->pic_order_cnt; + rps_used[rps_pics] = 0; +@@ -1155,8 +1170,7 @@ static int vaapi_encode_h265_init_slice_params(AVCodecContext *avctx, + vslice->ref_pic_list1[i].flags = VA_PICTURE_HEVC_INVALID; + } + +- av_assert0(pic->nb_refs <= 2); +- if (pic->nb_refs >= 1) { ++ if (pic->nb_refs[0]) { + // Backward reference for P- or B-frame. + av_assert0(pic->type == PICTURE_TYPE_P || + pic->type == PICTURE_TYPE_B); +@@ -1165,7 +1179,7 @@ static int vaapi_encode_h265_init_slice_params(AVCodecContext *avctx, + // Reference for GPB B-frame, L0 == L1 + vslice->ref_pic_list1[0] = vpic->reference_frames[0]; + } +- if (pic->nb_refs >= 2) { ++ if (pic->nb_refs[1]) { + // Forward reference for B-frame. + av_assert0(pic->type == PICTURE_TYPE_B); + vslice->ref_pic_list1[0] = vpic->reference_frames[1]; +diff --git a/libavcodec/vaapi_encode_mpeg2.c b/libavcodec/vaapi_encode_mpeg2.c +index 9261d19..8000ae1 100644 +--- a/libavcodec/vaapi_encode_mpeg2.c ++++ b/libavcodec/vaapi_encode_mpeg2.c +@@ -458,12 +458,12 @@ static int vaapi_encode_mpeg2_init_picture_params(AVCodecContext *avctx, + break; + case PICTURE_TYPE_P: + vpic->picture_type = VAEncPictureTypePredictive; +- vpic->forward_reference_picture = pic->refs[0]->recon_surface; ++ vpic->forward_reference_picture = pic->refs[0][0]->recon_surface; + break; + case PICTURE_TYPE_B: + vpic->picture_type = VAEncPictureTypeBidirectional; +- vpic->forward_reference_picture = pic->refs[0]->recon_surface; +- vpic->backward_reference_picture = pic->refs[1]->recon_surface; ++ vpic->forward_reference_picture = pic->refs[0][0]->recon_surface; ++ vpic->backward_reference_picture = pic->refs[1][0]->recon_surface; + break; + default: + av_assert0(0 && "invalid picture type"); +diff --git a/libavcodec/vaapi_encode_vp8.c b/libavcodec/vaapi_encode_vp8.c +index ae6a8d3..b96e4cd 100644 +--- a/libavcodec/vaapi_encode_vp8.c ++++ b/libavcodec/vaapi_encode_vp8.c +@@ -86,7 +86,7 @@ static int vaapi_encode_vp8_init_picture_params(AVCodecContext *avctx, + switch (pic->type) { + case PICTURE_TYPE_IDR: + case PICTURE_TYPE_I: +- av_assert0(pic->nb_refs == 0); ++ av_assert0(pic->nb_refs[0] == 0 && pic->nb_refs[1] == 0); + vpic->ref_flags.bits.force_kf = 1; + vpic->ref_last_frame = + vpic->ref_gf_frame = +@@ -94,14 +94,14 @@ static int vaapi_encode_vp8_init_picture_params(AVCodecContext *avctx, + VA_INVALID_SURFACE; + break; + case PICTURE_TYPE_P: +- av_assert0(pic->nb_refs == 1); ++ av_assert0(!pic->nb_refs[1]); + vpic->ref_flags.bits.no_ref_last = 0; + vpic->ref_flags.bits.no_ref_gf = 1; + vpic->ref_flags.bits.no_ref_arf = 1; + vpic->ref_last_frame = + vpic->ref_gf_frame = + vpic->ref_arf_frame = +- pic->refs[0]->recon_surface; ++ pic->refs[0][0]->recon_surface; + break; + default: + av_assert0(0 && "invalid picture type"); +diff --git a/libavcodec/vaapi_encode_vp9.c b/libavcodec/vaapi_encode_vp9.c +index af1353c..d9e8ba6 100644 +--- a/libavcodec/vaapi_encode_vp9.c ++++ b/libavcodec/vaapi_encode_vp9.c +@@ -96,15 +96,15 @@ static int vaapi_encode_vp9_init_picture_params(AVCodecContext *avctx, + + switch (pic->type) { + case PICTURE_TYPE_IDR: +- av_assert0(pic->nb_refs == 0); ++ av_assert0(pic->nb_refs[0] == 0 && pic->nb_refs[1] == 0); + vpic->ref_flags.bits.force_kf = 1; + vpic->refresh_frame_flags = 0xff; + hpic->slot = 0; + break; + case PICTURE_TYPE_P: +- av_assert0(pic->nb_refs == 1); ++ av_assert0(!pic->nb_refs[1]); + { +- VAAPIEncodeVP9Picture *href = pic->refs[0]->priv_data; ++ VAAPIEncodeVP9Picture *href = pic->refs[0][0]->priv_data; + av_assert0(href->slot == 0 || href->slot == 1); + + if (ctx->max_b_depth > 0) { +@@ -120,10 +120,10 @@ static int vaapi_encode_vp9_init_picture_params(AVCodecContext *avctx, + } + break; + case PICTURE_TYPE_B: +- av_assert0(pic->nb_refs == 2); ++ av_assert0(pic->nb_refs[0] && pic->nb_refs[1]); + { +- VAAPIEncodeVP9Picture *href0 = pic->refs[0]->priv_data, +- *href1 = pic->refs[1]->priv_data; ++ VAAPIEncodeVP9Picture *href0 = pic->refs[0][0]->priv_data, ++ *href1 = pic->refs[1][0]->priv_data; + av_assert0(href0->slot < pic->b_depth + 1 && + href1->slot < pic->b_depth + 1); + +@@ -157,12 +157,14 @@ static int vaapi_encode_vp9_init_picture_params(AVCodecContext *avctx, + for (i = 0; i < FF_ARRAY_ELEMS(vpic->reference_frames); i++) + vpic->reference_frames[i] = VA_INVALID_SURFACE; + +- for (i = 0; i < pic->nb_refs; i++) { +- VAAPIEncodePicture *ref_pic = pic->refs[i]; +- int slot; +- slot = ((VAAPIEncodeVP9Picture*)ref_pic->priv_data)->slot; +- av_assert0(vpic->reference_frames[slot] == VA_INVALID_SURFACE); +- vpic->reference_frames[slot] = ref_pic->recon_surface; ++ for (i = 0; i < MAX_REFERENCE_LIST_NUM; i++) { ++ for (int j = 0; j < pic->nb_refs[i]; j++) { ++ VAAPIEncodePicture *ref_pic = pic->refs[i][j]; ++ int slot; ++ slot = ((VAAPIEncodeVP9Picture*)ref_pic->priv_data)->slot; ++ av_assert0(vpic->reference_frames[slot] == VA_INVALID_SURFACE); ++ vpic->reference_frames[slot] = ref_pic->recon_surface; ++ } + } + + vpic->pic_flags.bits.frame_type = (pic->type != PICTURE_TYPE_IDR); +-- +2.41.0 + diff --git a/ffmpeg.spec b/ffmpeg.spec index d68704b..4a20644 100644 --- a/ffmpeg.spec +++ b/ffmpeg.spec @@ -92,7 +92,7 @@ Name: ffmpeg %global pkg_name %{name}%{?pkg_suffix} Version: 6.0 -Release: 15%{?dist} +Release: 16%{?dist} Summary: A complete solution to record, convert and stream audio and video License: GPL-3.0-or-later URL: https://ffmpeg.org/ @@ -129,6 +129,16 @@ Patch6: 0001-avcodec-x86-mathops-clip-constants-used-with-shift-i.patch # See: https://bugzilla.rpmfusion.org/show_bug.cgi?id=6773 Patch7: 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 + # Set up dlopen for openh264 Patch1001: ffmpeg-dlopen-openh264.patch @@ -861,6 +871,10 @@ rm -rf %{buildroot}%{_datadir}/%{name}/examples %{_mandir}/man3/libswscale.3* %changelog +* 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 + * Sun Oct 08 2023 Dominik Mierzejewski - 6.0-15 - Backport upstream patch to fix segfault when passing non-existent filter option (rfbz#6773) From 3739445cffd653a4def4ad145235d1253ad83d31 Mon Sep 17 00:00:00 2001 From: Neal Gompa Date: Fri, 10 Nov 2023 07:13:31 -0500 Subject: [PATCH 15/95] Add patches to support enhanced RTMP and AV1 encoding through VA-API - Force AAC decoding through fdk-aac-free --- ...l-v10-Support-enhanced-flv-in-FFmpeg.patch | 1230 +++++ enable_decoders | 1 - enable_encoders | 1 + ffmpeg-ge-av1-vaapi-encode-support.patch | 3984 +++++++++++++++++ ffmpeg.spec | 16 +- 5 files changed, 5230 insertions(+), 2 deletions(-) create mode 100644 FFmpeg-devel-v10-Support-enhanced-flv-in-FFmpeg.patch create mode 100644 ffmpeg-ge-av1-vaapi-encode-support.patch diff --git a/FFmpeg-devel-v10-Support-enhanced-flv-in-FFmpeg.patch b/FFmpeg-devel-v10-Support-enhanced-flv-in-FFmpeg.patch new file mode 100644 index 0000000..28ff7bb --- /dev/null +++ b/FFmpeg-devel-v10-Support-enhanced-flv-in-FFmpeg.patch @@ -0,0 +1,1230 @@ +From patchwork Mon May 15 08:31:56 2023 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +X-Patchwork-Submitter: Steven Liu +X-Patchwork-Id: 41615 +Delivered-To: ffmpegpatchwork2@gmail.com +Received: by 2002:a05:6a20:ba91:b0:105:feb:71f2 with SMTP id + fb17csp1443896pzb; + Mon, 15 May 2023 01:33:01 -0700 (PDT) +X-Google-Smtp-Source: + ACHHUZ69PgG6fq/KF6IIeKoVV29fkg7cAJfmPD3LnnTmI9YYVAPo/alZm7B+7f+FoOgn9rHdYUo5 +X-Received: by 2002:a17:907:97cb:b0:96a:4654:9a57 with SMTP id + js11-20020a17090797cb00b0096a46549a57mr16869758ejc.54.1684139580951; + Mon, 15 May 2023 01:33:00 -0700 (PDT) +ARC-Seal: i=1; a=rsa-sha256; t=1684139580; cv=none; + d=google.com; s=arc-20160816; + b=iOREUkvWDLqSJl40trM7wg3ufEQ23FOBLjpslXsds5HWyK48b/76lFgQwRfHJbHqbh + vc4N6DopB5msRi0VK/pJnDAdtuyQR2tqEgLvbZpHJzjK1zHUKRV5JHlmVhNvQOfYWpMR + VL/1OMmbTctEza2Z7/VYsrVLHLy4QOlLh4w/JdRcx/7rhiOA1ixpMxC4qUb5IGMhnqen + P2dDbAoqdmGUZtmA4VOfxkgkHnIaeFv+UffJGIZs1Lyb7c3zytwdpLLiezRzVLWQaStW + TVdcDk45pOrA29lZ46Tq8YNJP7O5zfSevFIqrB85mUjSNoyZi24gz19yxJa/09O1qb+o + thzw== +ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; + s=arc-20160816; + h=sender:errors-to:content-transfer-encoding:cc:reply-to + :list-subscribe:list-help:list-post:list-archive:list-unsubscribe + :list-id:precedence:subject:feedback-id:mime-version:references + :in-reply-to:message-id:date:to:from:delivered-to; + bh=Qg7uugO6uqQCX67+SdNELVYF39/WDPRDFt1+H7toQ+s=; + b=b1cxdqSVG1Oc157HlNUA+LfJhknU/nr3g5wnSLXmP7DrR+RQp2CFwGfjV+wTkfWLok + WydumkYG2biOpmhMi+mG4ci5WvU2R9bv1qpKGreRpsImGmjubQxu5CC9gwmenz3c+1v8 + pu+qkw142w9uMerjOpaw6oWvaHq9hWGVy6Uni33AqMJhfj9WqSwBCezk62krxzBar/VN + XNbzzpAMIuXcj0DcHS70oDHOTbtLq4uDLGpkQwnBpYbswfGD0h8N+B+BSCs3ZqN/l5Jc + juIQY4i3ja2W1yHm6Zlze2qU8lFRPzRwVBZBv9vro88VyFic0UZx9wRuIqJB9BZIb0h/ + vkiA== +ARC-Authentication-Results: i=1; mx.google.com; + spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org + designates 79.124.17.100 as permitted sender) + smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org +Return-Path: +Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) + by mx.google.com with ESMTP id + gt37-20020a1709072da500b0096b1c38458dsi2828116ejc.409.2023.05.15.01.33.00; + Mon, 15 May 2023 01:33:00 -0700 (PDT) +Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org + designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; +Authentication-Results: mx.google.com; + spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org + designates 79.124.17.100 as permitted sender) + smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org +Received: from [127.0.1.1] (localhost [127.0.0.1]) + by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id D930568BE0C; + Mon, 15 May 2023 11:32:57 +0300 (EEST) +X-Original-To: ffmpeg-devel@ffmpeg.org +Delivered-To: ffmpeg-devel@ffmpeg.org +Received: from bg4.exmail.qq.com (bg4.exmail.qq.com [43.155.67.158]) + by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 522F7680274 + for ; Mon, 15 May 2023 11:32:49 +0300 (EEST) +X-QQ-mid: bizesmtp68t1684139564tg642pbl +Received: from localhost ( [103.102.203.204]) by bizesmtp.qq.com (ESMTP) with + id ; Mon, 15 May 2023 16:32:42 +0800 (CST) +X-QQ-SSF: 01100000000000Z0Z000000A0000000 +X-QQ-FEAT: nCMT0YKS3i1MU7IXSsiS1Rwde6i/4Rq2kuPO2PoXw3OvtJB24MU+Y2GwdEg4Y + pg0ZfSggM3VBmRCkHI3ioSOH2mvVyYG9LgwhhyfixPaFItcpF4EF6xoZepQpa1H5v1BDi7s + iwCwF3shgH8dl96iJKKryT4TtjUTnYRoRhCPtLCGfUthaM/R44xdqxRvjDqIVn1BUMb5GPu + DMuaskzO8QQCFxvduUvovkXjJc5v17Krm2lf945Tmm/pIpV/qLjAgAhYHqOoxrgBGHZDYWY + 0XeS7RvYkKTR24z9m9Sk75veOTKtFzksnbLJYkIDYj+voAd1djXPJWtuB2elhm/DIa9+5lW + 2DnKrJ/Bb2Ok13ggXoC600jHcxkLbuOqDuK5k5Dhub7ECOTPJythkMV+FYQCw== +X-QQ-GoodBg: 0 +X-BIZMAIL-ID: 14547348156280638791 +From: Steven Liu +To: ffmpeg-devel@ffmpeg.org +Date: Mon, 15 May 2023 16:31:56 +0800 +Message-Id: <20230515083201.48201-2-lq@chinaffmpeg.org> +X-Mailer: git-send-email 2.40.0 +In-Reply-To: <20230515083201.48201-1-lq@chinaffmpeg.org> +References: + + <20230515083201.48201-1-lq@chinaffmpeg.org> +MIME-Version: 1.0 +X-QQ-SENDSIZE: 520 +Feedback-ID: bizesmtp:chinaffmpeg.org:qybglogicsvrsz:qybglogicsvrsz3a-3 +Subject: [FFmpeg-devel] [PATCH v10 1/6] avformat/flvenc: support mux hevc in + enhanced flv +X-BeenThere: ffmpeg-devel@ffmpeg.org +X-Mailman-Version: 2.1.29 +Precedence: list +List-Id: FFmpeg development discussions and patches +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +Reply-To: FFmpeg development discussions and patches +Cc: Steven Liu +Errors-To: ffmpeg-devel-bounces@ffmpeg.org +Sender: "ffmpeg-devel" +X-TUID: WUhHC4/dXuk+ + +Signed-off-by: Steven Liu +--- + libavformat/Makefile | 2 +- + libavformat/flv.h | 15 +++++++++++++++ + libavformat/flvenc.c | 38 +++++++++++++++++++++++++++++--------- + 3 files changed, 45 insertions(+), 10 deletions(-) + +diff --git a/libavformat/Makefile b/libavformat/Makefile +index f8ad7c6a11..1ef3d15467 100644 +--- a/libavformat/Makefile ++++ b/libavformat/Makefile +@@ -214,7 +214,7 @@ OBJS-$(CONFIG_FLAC_MUXER) += flacenc.o flacenc_header.o \ + OBJS-$(CONFIG_FLIC_DEMUXER) += flic.o + OBJS-$(CONFIG_FLV_DEMUXER) += flvdec.o + OBJS-$(CONFIG_LIVE_FLV_DEMUXER) += flvdec.o +-OBJS-$(CONFIG_FLV_MUXER) += flvenc.o avc.o ++OBJS-$(CONFIG_FLV_MUXER) += flvenc.o avc.o hevc.o + OBJS-$(CONFIG_FOURXM_DEMUXER) += 4xm.o + OBJS-$(CONFIG_FRAMECRC_MUXER) += framecrcenc.o framehash.o + OBJS-$(CONFIG_FRAMEHASH_MUXER) += hashenc.o framehash.o +diff --git a/libavformat/flv.h b/libavformat/flv.h +index 3571b90279..91e0a4140c 100644 +--- a/libavformat/flv.h ++++ b/libavformat/flv.h +@@ -35,6 +35,12 @@ + + #define FLV_VIDEO_FRAMETYPE_OFFSET 4 + ++/* Extended VideoTagHeader ++ * defined in reference link: ++ * https://github.com/veovera/enhanced-rtmp/blob/main/enhanced-rtmp-v1.pdf ++ * */ ++#define FLV_IS_EX_HEADER 0x80 ++ + /* bitmasks to isolate specific values */ + #define FLV_AUDIO_CHANNEL_MASK 0x01 + #define FLV_AUDIO_SAMPLESIZE_MASK 0x02 +@@ -112,6 +118,15 @@ enum { + FLV_CODECID_MPEG4 = 9, + }; + ++enum { ++ PacketTypeSequenceStart = 0, ++ PacketTypeCodedFrames = 1, ++ PacketTypeSequenceEnd = 2, ++ PacketTypeCodedFramesX = 3, ++ PacketTypeMetadata = 4, ++ PacketTypeMPEG2TSSequenceStart = 5, ++}; ++ + enum { + FLV_FRAME_KEY = 1 << FLV_VIDEO_FRAMETYPE_OFFSET, ///< key frame (for AVC, a seekable frame) + FLV_FRAME_INTER = 2 << FLV_VIDEO_FRAMETYPE_OFFSET, ///< inter frame (for AVC, a non-seekable frame) +diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c +index 721f062811..35e198fa15 100644 +--- a/libavformat/flvenc.c ++++ b/libavformat/flvenc.c +@@ -28,6 +28,7 @@ + #include "libavcodec/mpeg4audio.h" + #include "avio.h" + #include "avc.h" ++#include "hevc.h" + #include "avformat.h" + #include "flv.h" + #include "internal.h" +@@ -46,6 +47,7 @@ static const AVCodecTag flv_video_codec_ids[] = { + { AV_CODEC_ID_VP6, FLV_CODECID_VP6 }, + { AV_CODEC_ID_VP6A, FLV_CODECID_VP6A }, + { AV_CODEC_ID_H264, FLV_CODECID_H264 }, ++ { AV_CODEC_ID_HEVC, MKBETAG('h', 'v', 'c', '1') }, + { AV_CODEC_ID_NONE, 0 } + }; + +@@ -489,7 +491,7 @@ static void flv_write_codec_header(AVFormatContext* s, AVCodecParameters* par, i + FLVContext *flv = s->priv_data; + + if (par->codec_id == AV_CODEC_ID_AAC || par->codec_id == AV_CODEC_ID_H264 +- || par->codec_id == AV_CODEC_ID_MPEG4) { ++ || par->codec_id == AV_CODEC_ID_MPEG4 || par->codec_id == AV_CODEC_ID_HEVC) { + int64_t pos; + avio_w8(pb, + par->codec_type == AVMEDIA_TYPE_VIDEO ? +@@ -532,10 +534,19 @@ static void flv_write_codec_header(AVFormatContext* s, AVCodecParameters* par, i + } + avio_write(pb, par->extradata, par->extradata_size); + } else { +- avio_w8(pb, par->codec_tag | FLV_FRAME_KEY); // flags +- avio_w8(pb, 0); // AVC sequence header +- avio_wb24(pb, 0); // composition time +- ff_isom_write_avcc(pb, par->extradata, par->extradata_size); ++ if (par->codec_id == AV_CODEC_ID_HEVC) { ++ avio_w8(pb, FLV_IS_EX_HEADER | PacketTypeSequenceStart); // ExVideoTagHeader mode with PacketTypeSequenceStart ++ avio_write(pb, "hvc1", 4); ++ } else { ++ avio_w8(pb, par->codec_tag | FLV_FRAME_KEY); // flags ++ avio_w8(pb, 0); // AVC sequence header ++ avio_wb24(pb, 0); // composition time ++ } ++ ++ if (par->codec_id == AV_CODEC_ID_HEVC) ++ ff_isom_write_hvcc(pb, par->extradata, par->extradata_size, 0); ++ else ++ ff_isom_write_avcc(pb, par->extradata, par->extradata_size); + } + data_size = avio_tell(pb) - pos; + avio_seek(pb, -data_size - 10, SEEK_CUR); +@@ -832,13 +843,13 @@ static int flv_write_packet(AVFormatContext *s, AVPacket *pkt) + if (par->codec_id == AV_CODEC_ID_VP6F || par->codec_id == AV_CODEC_ID_VP6A || + par->codec_id == AV_CODEC_ID_VP6 || par->codec_id == AV_CODEC_ID_AAC) + flags_size = 2; +- else if (par->codec_id == AV_CODEC_ID_H264 || par->codec_id == AV_CODEC_ID_MPEG4) ++ else if (par->codec_id == AV_CODEC_ID_H264 || par->codec_id == AV_CODEC_ID_MPEG4 || par->codec_id == AV_CODEC_ID_HEVC) + flags_size = 5; + else + flags_size = 1; + + if (par->codec_id == AV_CODEC_ID_AAC || par->codec_id == AV_CODEC_ID_H264 +- || par->codec_id == AV_CODEC_ID_MPEG4) { ++ || par->codec_id == AV_CODEC_ID_MPEG4 || par->codec_id == AV_CODEC_ID_HEVC) { + size_t side_size; + uint8_t *side = av_packet_get_side_data(pkt, AV_PKT_DATA_NEW_EXTRADATA, &side_size); + if (side && side_size > 0 && (side_size != par->extradata_size || memcmp(side, par->extradata, side_size))) { +@@ -858,7 +869,7 @@ static int flv_write_packet(AVFormatContext *s, AVPacket *pkt) + "Packets are not in the proper order with respect to DTS\n"); + return AVERROR(EINVAL); + } +- if (par->codec_id == AV_CODEC_ID_H264 || par->codec_id == AV_CODEC_ID_MPEG4) { ++ if (par->codec_id == AV_CODEC_ID_H264 || par->codec_id == AV_CODEC_ID_MPEG4 || par->codec_id == AV_CODEC_ID_HEVC) { + if (pkt->pts == AV_NOPTS_VALUE) { + av_log(s, AV_LOG_ERROR, "Packet is missing PTS\n"); + return AVERROR(EINVAL); +@@ -903,6 +914,10 @@ static int flv_write_packet(AVFormatContext *s, AVPacket *pkt) + if (par->extradata_size > 0 && *(uint8_t*)par->extradata != 1) + if ((ret = ff_avc_parse_nal_units_buf(pkt->data, &data, &size)) < 0) + return ret; ++ } else if (par->codec_id == AV_CODEC_ID_HEVC) { ++ if (par->extradata_size > 0 && *(uint8_t*)par->extradata != 1) ++ if ((ret = ff_hevc_annexb2mp4_buf(pkt->data, &data, &size, 0, NULL)) < 0) ++ return ret; + } else if (par->codec_id == AV_CODEC_ID_AAC && pkt->size > 2 && + (AV_RB16(pkt->data) & 0xfff0) == 0xfff0) { + if (!s->streams[pkt->stream_index]->nb_frames) { +@@ -964,7 +979,12 @@ static int flv_write_packet(AVFormatContext *s, AVPacket *pkt) + avio_wb32(pb, data_size + 11); + } else { + av_assert1(flags>=0); +- avio_w8(pb,flags); ++ if (par->codec_id == AV_CODEC_ID_HEVC) { ++ avio_w8(pb, FLV_IS_EX_HEADER | PacketTypeCodedFramesX); // ExVideoTagHeader mode with PacketTypeCodedFramesX ++ avio_write(pb, "hvc1", 4); ++ } else { ++ avio_w8(pb, flags); ++ } + if (par->codec_id == AV_CODEC_ID_VP6) + avio_w8(pb,0); + if (par->codec_id == AV_CODEC_ID_VP6F || par->codec_id == AV_CODEC_ID_VP6A) { + +From patchwork Mon May 15 08:31:57 2023 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +X-Patchwork-Submitter: Steven Liu +X-Patchwork-Id: 41616 +Delivered-To: ffmpegpatchwork2@gmail.com +Received: by 2002:a05:6a20:ba91:b0:105:feb:71f2 with SMTP id + fb17csp1444123pzb; + Mon, 15 May 2023 01:33:22 -0700 (PDT) +X-Google-Smtp-Source: + ACHHUZ4qSqnHARATYvNTOiXhMIIgGWUHo612wN3Ui1r3cYPQd57E+B9kiCRYijDhzgObKMKkDm54 +X-Received: by 2002:a17:907:6e8e:b0:94f:3521:396 with SMTP id + sh14-20020a1709076e8e00b0094f35210396mr35740883ejc.23.1684139602011; + Mon, 15 May 2023 01:33:22 -0700 (PDT) +ARC-Seal: i=1; a=rsa-sha256; t=1684139601; cv=none; + d=google.com; s=arc-20160816; + b=EFJgx9cm5ew2+PIpTeHi7QCzos//oOs5q/HndQxc0+dHYlju5X4rVSACmfk9L0DH3j + +cG0n2/3wAsguA1rC3B8a+qXkRfAXC1ropuhDwKCZCdw0Iv40Vm4JeHolEQWRni8Ko+F + MhWY7AvxrX4GsO0pp4SfKsVFaJdo18dlpn+BUd9FX5N7V6lUTadQsVcJYJBd2B2MIRUi + mJaEPp8WpRkiS92DgWhPzUC9ELnwrySnNL0mOo9DCd9cjFXQ9KXW6qjRoP0blbL8N2ws + BlY2dJVmSM36n/GK9gZb+6fUg3xVufDUfdRr0m4jpa/ILD93/nwAZsqhk3k4j00se+CO + 7Vrw== +ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; + s=arc-20160816; + h=sender:errors-to:content-transfer-encoding:cc:reply-to + :list-subscribe:list-help:list-post:list-archive:list-unsubscribe + :list-id:precedence:subject:feedback-id:mime-version:references + :in-reply-to:message-id:date:to:from:delivered-to; + bh=ygUb60Tr5LbPnhiS1As+hL+qX45KII+ocpY9X3Jq4TI=; + b=UpGhqbfo/+m9WW5qE92LKOdOlxkCWyy2QVqiXCjXpxepdDd0IKkhGqSspte9zJrUT8 + QWg8IiDK6JTnGnvp+hO6doZjhXc1GyyTx6cMQQX+2JzqTtbWF03S94GwBgmN/U2RIK9M + f980SSgfNZRSJF5kJ+dO2ix4M5WIWhxEYB/MRzn/RbxAvYkwLNG1gMMBTNimogbFsXRo + h5WgGxO4k8mx/x8PBrtNv1aPZ86FAcXC3Aieao7aVnRDvWjepEus5jEfGu2QuqnvM2qK + WIjUyFrppJL/crANtgR+tFcL8395bRGYObYtIBblUQ/g5ddHzjsaClJ/42r3h1vez39q + nPjQ== +ARC-Authentication-Results: i=1; mx.google.com; + spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org + designates 79.124.17.100 as permitted sender) + smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org +Return-Path: +Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) + by mx.google.com with ESMTP id + v21-20020a1709060b5500b0095ec54a22bcsi10907595ejg.106.2023.05.15.01.33.21; + Mon, 15 May 2023 01:33:21 -0700 (PDT) +Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org + designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; +Authentication-Results: mx.google.com; + spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org + designates 79.124.17.100 as permitted sender) + smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org +Received: from [127.0.1.1] (localhost [127.0.0.1]) + by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id D3F7668C092; + Mon, 15 May 2023 11:33:18 +0300 (EEST) +X-Original-To: ffmpeg-devel@ffmpeg.org +Delivered-To: ffmpeg-devel@ffmpeg.org +Received: from bg4.exmail.qq.com (bg4.exmail.qq.com [43.155.67.158]) + by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8180368C004 + for ; Mon, 15 May 2023 11:33:11 +0300 (EEST) +X-QQ-mid: bizesmtp62t1684139585txhp32ou +Received: from localhost ( [103.102.203.204]) by bizesmtp.qq.com (ESMTP) with + id ; Mon, 15 May 2023 16:33:04 +0800 (CST) +X-QQ-SSF: 01100000000000Z0Z000000A0000000 +X-QQ-FEAT: 6ArnuSDJ+inVC06MH1nrJeu56+35diptW3dCdHt3bMayFZoCyE8QyUO0QY9zm + iY62JCSpSKYEK4ca2kpxkB99PI50FiWfNtzLDZ+VzUTy013GMpLwh1CWeVX5cF15RyEAIC9 + u3Ozg7IY8mv+GiDtf6FDgSyumE1D93qxV1R2sJ5v38V3NbNPcikg0aDxZXOlC+Hr+LdhsZi + 4X5tDi3NovhpCf+8Wo+ZaejHOrE8MUcUGpbh8dHRew6dnmkdkK5ytSHSZEye8RsXZnMdp4A + mqBZqIDGw1a4e04JAc/NDCs7qq4qthxMFB1skhaOv6DLcL+EqV2QFwnJn7V5Oof7BwfjaTG + mEAVpiZDnQhFvOgHemH1v61Blub2nCnAurrGhGMaywIzFXT87aOSLCDlFprSg== +X-QQ-GoodBg: 0 +X-BIZMAIL-ID: 11210839191292587357 +From: Steven Liu +To: ffmpeg-devel@ffmpeg.org +Date: Mon, 15 May 2023 16:31:57 +0800 +Message-Id: <20230515083201.48201-3-lq@chinaffmpeg.org> +X-Mailer: git-send-email 2.40.0 +In-Reply-To: <20230515083201.48201-1-lq@chinaffmpeg.org> +References: + + <20230515083201.48201-1-lq@chinaffmpeg.org> +MIME-Version: 1.0 +X-QQ-SENDSIZE: 520 +Feedback-ID: bizesmtp:chinaffmpeg.org:qybglogicsvrsz:qybglogicsvrsz3a-3 +Subject: [FFmpeg-devel] [PATCH v10 2/6] avformat/flvdec: support demux hevc + in enhanced flv +X-BeenThere: ffmpeg-devel@ffmpeg.org +X-Mailman-Version: 2.1.29 +Precedence: list +List-Id: FFmpeg development discussions and patches +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +Reply-To: FFmpeg development discussions and patches +Cc: Steven Liu +Errors-To: ffmpeg-devel-bounces@ffmpeg.org +Sender: "ffmpeg-devel" +X-TUID: SFsjHMHu2ISl + +Signed-off-by: Steven Liu +--- + libavformat/flvdec.c | 58 ++++++++++++++++++++++++++++++++++++++------ + 1 file changed, 50 insertions(+), 8 deletions(-) + +diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c +index d83edff727..c8e6cadf1c 100644 +--- a/libavformat/flvdec.c ++++ b/libavformat/flvdec.c +@@ -79,6 +79,8 @@ typedef struct FLVContext { + int64_t last_ts; + int64_t time_offset; + int64_t time_pos; ++ ++ uint8_t exheader; + } FLVContext; + + /* AMF date type */ +@@ -302,13 +304,25 @@ static void flv_set_audio_codec(AVFormatContext *s, AVStream *astream, + } + } + +-static int flv_same_video_codec(AVCodecParameters *vpar, int flags) ++static int flv_same_video_codec(AVFormatContext *s, AVCodecParameters *vpar, int flags) + { + int flv_codecid = flags & FLV_VIDEO_CODECID_MASK; ++ FLVContext *flv = s->priv_data; + + if (!vpar->codec_id && !vpar->codec_tag) + return 1; + ++ if (flv->exheader) { ++ uint8_t *codec_id_str = (uint8_t *)s->pb->buf_ptr; ++ uint32_t codec_id = codec_id_str[3] | codec_id_str[2] << 8 | codec_id_str[1] << 16 | codec_id_str[0] << 24; ++ switch(codec_id) { ++ case MKBETAG('h', 'v', 'c', '1'): ++ return vpar->codec_id == AV_CODEC_ID_HEVC; ++ default: ++ break; ++ } ++ } ++ + switch (flv_codecid) { + case FLV_CODECID_H263: + return vpar->codec_id == AV_CODEC_ID_FLV1; +@@ -331,9 +345,24 @@ static int flv_set_video_codec(AVFormatContext *s, AVStream *vstream, + int flv_codecid, int read) + { + FFStream *const vstreami = ffstream(vstream); ++ FLVContext *flv = s->priv_data; + int ret = 0; + AVCodecParameters *par = vstream->codecpar; + enum AVCodecID old_codec_id = vstream->codecpar->codec_id; ++ flv_codecid &= FLV_VIDEO_CODECID_MASK; ++ ++ if (flv->exheader) { ++ uint32_t codec_id = avio_rb32(s->pb); ++ ++ switch(codec_id) { ++ case MKBETAG('h', 'v', 'c', '1'): ++ par->codec_id = AV_CODEC_ID_HEVC; ++ vstreami->need_parsing = AVSTREAM_PARSE_HEADERS; ++ return 4; ++ default: ++ break; ++ } ++ } + switch (flv_codecid) { + case FLV_CODECID_H263: + par->codec_id = AV_CODEC_ID_FLV1; +@@ -796,6 +825,7 @@ static int flv_read_header(AVFormatContext *s) + s->start_time = 0; + flv->sum_flv_tag_size = 0; + flv->last_keyframe_stream_index = -1; ++ flv->exheader = 0; + + return 0; + } +@@ -1071,6 +1101,11 @@ retry: + } else if (type == FLV_TAG_TYPE_VIDEO) { + stream_type = FLV_STREAM_TYPE_VIDEO; + flags = avio_r8(s->pb); ++ /* ++ * Reference Enhancing FLV 2023-03-v1.0.0-B.8 ++ * https://github.com/veovera/enhanced-rtmp/blob/main/enhanced-rtmp-v1.pdf ++ * */ ++ flv->exheader = (flags >> 7) & 1; + size--; + if ((flags & FLV_VIDEO_FRAMETYPE_MASK) == FLV_FRAME_VIDEO_INFO_CMD) + goto skip; +@@ -1129,7 +1164,7 @@ skip: + break; + } else if (stream_type == FLV_STREAM_TYPE_VIDEO) { + if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && +- (s->video_codec_id || flv_same_video_codec(st->codecpar, flags))) ++ (s->video_codec_id || flv_same_video_codec(s, st->codecpar, flags))) + break; + } else if (stream_type == FLV_STREAM_TYPE_SUBTITLE) { + if (st->codecpar->codec_type == AVMEDIA_TYPE_SUBTITLE) +@@ -1230,7 +1265,7 @@ retry_duration: + avcodec_parameters_free(&par); + } + } else if (stream_type == FLV_STREAM_TYPE_VIDEO) { +- int ret = flv_set_video_codec(s, st, flags & FLV_VIDEO_CODECID_MASK, 1); ++ int ret = flv_set_video_codec(s, st, flags, 1); + if (ret < 0) + return ret; + size -= ret; +@@ -1242,16 +1277,23 @@ retry_duration: + + if (st->codecpar->codec_id == AV_CODEC_ID_AAC || + st->codecpar->codec_id == AV_CODEC_ID_H264 || +- st->codecpar->codec_id == AV_CODEC_ID_MPEG4) { +- int type = avio_r8(s->pb); +- size--; ++ st->codecpar->codec_id == AV_CODEC_ID_MPEG4 || ++ st->codecpar->codec_id == AV_CODEC_ID_HEVC) { ++ int type = 0; ++ if (flv->exheader && stream_type == FLV_STREAM_TYPE_VIDEO) { ++ type = flags & 0x0F; ++ } else { ++ type = avio_r8(s->pb); ++ size--; ++ } + + if (size < 0) { + ret = AVERROR_INVALIDDATA; + goto leave; + } + +- if (st->codecpar->codec_id == AV_CODEC_ID_H264 || st->codecpar->codec_id == AV_CODEC_ID_MPEG4) { ++ if (st->codecpar->codec_id == AV_CODEC_ID_H264 || st->codecpar->codec_id == AV_CODEC_ID_MPEG4 || ++ (st->codecpar->codec_id == AV_CODEC_ID_HEVC && type == PacketTypeCodedFrames)) { + // sign extension + int32_t cts = (avio_rb24(s->pb) + 0xff800000) ^ 0xff800000; + pts = av_sat_add64(dts, cts); +@@ -1267,7 +1309,7 @@ retry_duration: + } + } + if (type == 0 && (!st->codecpar->extradata || st->codecpar->codec_id == AV_CODEC_ID_AAC || +- st->codecpar->codec_id == AV_CODEC_ID_H264)) { ++ st->codecpar->codec_id == AV_CODEC_ID_H264 || st->codecpar->codec_id == AV_CODEC_ID_HEVC)) { + AVDictionaryEntry *t; + + if (st->codecpar->extradata) { + +From patchwork Mon May 15 08:31:58 2023 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +X-Patchwork-Submitter: Steven Liu +X-Patchwork-Id: 41617 +Delivered-To: ffmpegpatchwork2@gmail.com +Received: by 2002:a05:6a20:ba91:b0:105:feb:71f2 with SMTP id + fb17csp1444209pzb; + Mon, 15 May 2023 01:33:31 -0700 (PDT) +X-Google-Smtp-Source: + ACHHUZ5N/MWld9fXzokkRVS1e13AYakkRyH/RvyBiJ7xA512EWdWgrGE4ferugcTRoHNahvjayC9 +X-Received: by 2002:a17:907:9724:b0:96a:1260:dbf5 with SMTP id + jg36-20020a170907972400b0096a1260dbf5mr18082554ejc.45.1684139611447; + Mon, 15 May 2023 01:33:31 -0700 (PDT) +ARC-Seal: i=1; a=rsa-sha256; t=1684139611; cv=none; + d=google.com; s=arc-20160816; + b=op6Xl3YinOSd8d/Ya4YpQjHSbJx0t7fHaCHvvqvkJgTbKfjmTJjDFsMWkeT/ceA1lA + xV9Y1JGrAlZmudpgaJtXHukLJessnBrqaBy5gm0lX6bJ0X4AKJt/F7GB3FR3OPISq79w + 7djeHUx2VAxfWn1awCcFrcyyMPrGB2GPMdoXxcUVmySNNK0ohuroQ2JhVRajwj0sIBFg + f0pu7vXX9ct499tFl5rHEd//2Xl3rY6kNHfPlMOcJEclT+35TUaTWE88+rJODaiMArcZ + RaFK8xqfAOJjw0X9t6YiwBk1Kl/sFKEj71Fxu5khg7IvhF7kzRDSZXLCkKW9UvPYhGOl + 25Bw== +ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; + s=arc-20160816; + h=sender:errors-to:content-transfer-encoding:cc:reply-to + :list-subscribe:list-help:list-post:list-archive:list-unsubscribe + :list-id:precedence:subject:feedback-id:mime-version:references + :in-reply-to:message-id:date:to:from:delivered-to; + bh=0O0kUGD5r8lgXEiC2RUfiZ1ccVRPd03lWds0dqdVEq0=; + b=OAvZATeoNq/BI3pJd21Xz2nKh+ZI8Zkofe4Ob6USu1ZEOyZzK2xxgtxL6SjJAxecG6 + NfECg8e13DLbnVAB5OnMK8TY/HV/4N/iqPksn6PbJSkCyafRqg477+SRs7tOl89c3isr + Cp8o+j7t+gW2fkV9Y6L8MZa9etJpusa0LYXVBLPDs+tHNgXNec9UTA1YnoSyMqErrh58 + chMh6B6P+5aRcKrBfKZY1F8WAzMjphdQ78c3YZ+ikgGfkoPgRKTEUq+xQAMm7UXirMcn + qtndeDiQypN1eg7LiEbAsLhj7K2jibIlDmwUk+6JDE1ASz05FViAbk3nFfWydNP8iUlh + z+CQ== +ARC-Authentication-Results: i=1; mx.google.com; + spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org + designates 79.124.17.100 as permitted sender) + smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org +Return-Path: +Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) + by mx.google.com with ESMTP id + rv22-20020a17090710d600b00965e8c67d7dsi11399192ejb.285.2023.05.15.01.33.31; + Mon, 15 May 2023 01:33:31 -0700 (PDT) +Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org + designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; +Authentication-Results: mx.google.com; + spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org + designates 79.124.17.100 as permitted sender) + smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org +Received: from [127.0.1.1] (localhost [127.0.0.1]) + by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id CAF3668C08B; + Mon, 15 May 2023 11:33:22 +0300 (EEST) +X-Original-To: ffmpeg-devel@ffmpeg.org +Delivered-To: ffmpeg-devel@ffmpeg.org +Received: from bg4.exmail.qq.com (bg4.exmail.qq.com [43.155.67.158]) + by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 5613068C08B + for ; Mon, 15 May 2023 11:33:16 +0300 (EEST) +X-QQ-mid: bizesmtp62t1684139591t5vf5iss +Received: from localhost ( [103.102.203.204]) by bizesmtp.qq.com (ESMTP) with + id ; Mon, 15 May 2023 16:33:09 +0800 (CST) +X-QQ-SSF: 01100000000000Z0Z000000A0000000 +X-QQ-FEAT: 0VYWLLCf4rd8sf4B0xdI45yO9pa7cA5LkUN5r8jryl/9HUTcEOcDnq6sEFLpU + pZ/JnwSIqfqFtRB8Bq8+032WcwZIBdGWmOUpIZLcDlBPHVtS9YwSO56p7te0932mhQHQVWr + 2MJ60EhPcxfhXG3M89QSysYDgLjUIRbb/cP/Br05mCJ05c+Q4NzWwlRwweOG0lUJ4aMNli9 + i3Qf8lSAK8hK3JWYZP0Fg66JaFkZvw6Yz6N4ESVf4Vp85rwWKPfpBz538IiCze/ePbVgZWB + zvbU1mVAkapT05cTLyqAlv7tefflgoYcrW79Z+Opy2wSYDZLpCkRIe+w4yWG7eCg71dUgnc + 79D+MVyHSJjuXS/sQLaeFanS1V55WK4izy9J/bFHdSprmySwmpk8hf5zhIZOQ== +X-QQ-GoodBg: 0 +X-BIZMAIL-ID: 5377996165340525619 +From: Steven Liu +To: ffmpeg-devel@ffmpeg.org +Date: Mon, 15 May 2023 16:31:58 +0800 +Message-Id: <20230515083201.48201-4-lq@chinaffmpeg.org> +X-Mailer: git-send-email 2.40.0 +In-Reply-To: <20230515083201.48201-1-lq@chinaffmpeg.org> +References: + + <20230515083201.48201-1-lq@chinaffmpeg.org> +MIME-Version: 1.0 +X-QQ-SENDSIZE: 520 +Feedback-ID: bizesmtp:chinaffmpeg.org:qybglogicsvrsz:qybglogicsvrsz3a-3 +Subject: [FFmpeg-devel] [PATCH v10 3/6] avformat/flvenc: support mux av1 in + enhanced flv +X-BeenThere: ffmpeg-devel@ffmpeg.org +X-Mailman-Version: 2.1.29 +Precedence: list +List-Id: FFmpeg development discussions and patches +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +Reply-To: FFmpeg development discussions and patches +Cc: Steven Liu +Errors-To: ffmpeg-devel-bounces@ffmpeg.org +Sender: "ffmpeg-devel" +X-TUID: dRfPdsIvexzh + +Signed-off-by: Steven Liu +--- + libavformat/Makefile | 2 +- + libavformat/flvenc.c | 22 ++++++++++++++++++---- + 2 files changed, 19 insertions(+), 5 deletions(-) + +diff --git a/libavformat/Makefile b/libavformat/Makefile +index 1ef3d15467..c868e1626c 100644 +--- a/libavformat/Makefile ++++ b/libavformat/Makefile +@@ -214,7 +214,7 @@ OBJS-$(CONFIG_FLAC_MUXER) += flacenc.o flacenc_header.o \ + OBJS-$(CONFIG_FLIC_DEMUXER) += flic.o + OBJS-$(CONFIG_FLV_DEMUXER) += flvdec.o + OBJS-$(CONFIG_LIVE_FLV_DEMUXER) += flvdec.o +-OBJS-$(CONFIG_FLV_MUXER) += flvenc.o avc.o hevc.o ++OBJS-$(CONFIG_FLV_MUXER) += flvenc.o avc.o hevc.o av1.o + OBJS-$(CONFIG_FOURXM_DEMUXER) += 4xm.o + OBJS-$(CONFIG_FRAMECRC_MUXER) += framecrcenc.o framehash.o + OBJS-$(CONFIG_FRAMEHASH_MUXER) += hashenc.o framehash.o +diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c +index 35e198fa15..c1784b332d 100644 +--- a/libavformat/flvenc.c ++++ b/libavformat/flvenc.c +@@ -28,6 +28,7 @@ + #include "libavcodec/mpeg4audio.h" + #include "avio.h" + #include "avc.h" ++#include "av1.h" + #include "hevc.h" + #include "avformat.h" + #include "flv.h" +@@ -48,6 +49,7 @@ static const AVCodecTag flv_video_codec_ids[] = { + { AV_CODEC_ID_VP6A, FLV_CODECID_VP6A }, + { AV_CODEC_ID_H264, FLV_CODECID_H264 }, + { AV_CODEC_ID_HEVC, MKBETAG('h', 'v', 'c', '1') }, ++ { AV_CODEC_ID_AV1, MKBETAG('a', 'v', '0', '1') }, + { AV_CODEC_ID_NONE, 0 } + }; + +@@ -491,7 +493,8 @@ static void flv_write_codec_header(AVFormatContext* s, AVCodecParameters* par, i + FLVContext *flv = s->priv_data; + + if (par->codec_id == AV_CODEC_ID_AAC || par->codec_id == AV_CODEC_ID_H264 +- || par->codec_id == AV_CODEC_ID_MPEG4 || par->codec_id == AV_CODEC_ID_HEVC) { ++ || par->codec_id == AV_CODEC_ID_MPEG4 || par->codec_id == AV_CODEC_ID_HEVC ++ || par->codec_id == AV_CODEC_ID_AV1) { + int64_t pos; + avio_w8(pb, + par->codec_type == AVMEDIA_TYPE_VIDEO ? +@@ -537,6 +540,9 @@ static void flv_write_codec_header(AVFormatContext* s, AVCodecParameters* par, i + if (par->codec_id == AV_CODEC_ID_HEVC) { + avio_w8(pb, FLV_IS_EX_HEADER | PacketTypeSequenceStart); // ExVideoTagHeader mode with PacketTypeSequenceStart + avio_write(pb, "hvc1", 4); ++ } else if (par->codec_id == AV_CODEC_ID_AV1) { ++ avio_w8(pb, FLV_IS_EX_HEADER | PacketTypeSequenceStart); ++ avio_write(pb, "av01", 4); + } else { + avio_w8(pb, par->codec_tag | FLV_FRAME_KEY); // flags + avio_w8(pb, 0); // AVC sequence header +@@ -545,6 +551,8 @@ static void flv_write_codec_header(AVFormatContext* s, AVCodecParameters* par, i + + if (par->codec_id == AV_CODEC_ID_HEVC) + ff_isom_write_hvcc(pb, par->extradata, par->extradata_size, 0); ++ else if (par->codec_id == AV_CODEC_ID_AV1) ++ ff_isom_write_av1c(pb, par->extradata, par->extradata_size, 1); + else + ff_isom_write_avcc(pb, par->extradata, par->extradata_size); + } +@@ -843,13 +851,15 @@ static int flv_write_packet(AVFormatContext *s, AVPacket *pkt) + if (par->codec_id == AV_CODEC_ID_VP6F || par->codec_id == AV_CODEC_ID_VP6A || + par->codec_id == AV_CODEC_ID_VP6 || par->codec_id == AV_CODEC_ID_AAC) + flags_size = 2; +- else if (par->codec_id == AV_CODEC_ID_H264 || par->codec_id == AV_CODEC_ID_MPEG4 || par->codec_id == AV_CODEC_ID_HEVC) ++ else if (par->codec_id == AV_CODEC_ID_H264 || par->codec_id == AV_CODEC_ID_MPEG4 || ++ par->codec_id == AV_CODEC_ID_HEVC || par->codec_id == AV_CODEC_ID_AV1) + flags_size = 5; + else + flags_size = 1; + + if (par->codec_id == AV_CODEC_ID_AAC || par->codec_id == AV_CODEC_ID_H264 +- || par->codec_id == AV_CODEC_ID_MPEG4 || par->codec_id == AV_CODEC_ID_HEVC) { ++ || par->codec_id == AV_CODEC_ID_MPEG4 || par->codec_id == AV_CODEC_ID_HEVC ++ || par->codec_id == AV_CODEC_ID_AV1) { + size_t side_size; + uint8_t *side = av_packet_get_side_data(pkt, AV_PKT_DATA_NEW_EXTRADATA, &side_size); + if (side && side_size > 0 && (side_size != par->extradata_size || memcmp(side, par->extradata, side_size))) { +@@ -869,7 +879,8 @@ static int flv_write_packet(AVFormatContext *s, AVPacket *pkt) + "Packets are not in the proper order with respect to DTS\n"); + return AVERROR(EINVAL); + } +- if (par->codec_id == AV_CODEC_ID_H264 || par->codec_id == AV_CODEC_ID_MPEG4 || par->codec_id == AV_CODEC_ID_HEVC) { ++ if (par->codec_id == AV_CODEC_ID_H264 || par->codec_id == AV_CODEC_ID_MPEG4 || ++ par->codec_id == AV_CODEC_ID_HEVC || par->codec_id == AV_CODEC_ID_AV1) { + if (pkt->pts == AV_NOPTS_VALUE) { + av_log(s, AV_LOG_ERROR, "Packet is missing PTS\n"); + return AVERROR(EINVAL); +@@ -982,6 +993,9 @@ static int flv_write_packet(AVFormatContext *s, AVPacket *pkt) + if (par->codec_id == AV_CODEC_ID_HEVC) { + avio_w8(pb, FLV_IS_EX_HEADER | PacketTypeCodedFramesX); // ExVideoTagHeader mode with PacketTypeCodedFramesX + avio_write(pb, "hvc1", 4); ++ } else if (par->codec_id == AV_CODEC_ID_AV1) { ++ avio_w8(pb, FLV_IS_EX_HEADER | PacketTypeCodedFrames); ++ avio_write(pb, "av01", 4); + } else { + avio_w8(pb, flags); + } + +From patchwork Mon May 15 08:31:59 2023 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +X-Patchwork-Submitter: Steven Liu +X-Patchwork-Id: 41618 +Delivered-To: ffmpegpatchwork2@gmail.com +Received: by 2002:a05:6a20:ba91:b0:105:feb:71f2 with SMTP id + fb17csp1444290pzb; + Mon, 15 May 2023 01:33:41 -0700 (PDT) +X-Google-Smtp-Source: + ACHHUZ7k5HSYVpKlutDCH3BVN03oQ1eQ9NWjKwBebLGv5fK0d2qVGGgCtBo3XdEGlDTDUuvlDzRX +X-Received: by 2002:a17:907:9347:b0:94f:322d:909c with SMTP id + bv7-20020a170907934700b0094f322d909cmr26994118ejc.34.1684139620986; + Mon, 15 May 2023 01:33:40 -0700 (PDT) +ARC-Seal: i=1; a=rsa-sha256; t=1684139620; cv=none; + d=google.com; s=arc-20160816; + b=BBSgegXR1u0K767R9MAxQddt49hZNhDS+YgCHGYo0B07ClteK018739TK9tupVh7pK + wuvk/gzkEpIZpf2I3LQnpaxvQx0ZnllSKyz+x+560wEVKkQw5tlwpgr4qA3m0ApBBmQR + 2ZUu6WRpBnVeXJbT5n+ymITrLd1NVXLNPqoz7kL0iDML0b2iC9PqCoGRTHF6zJZFtCH2 + ZYUq4OdcbflvqqLBvKvSgEwuVof0bqDwD8kfq9noKTf7wrx5bcdIbq6XMYG1n6AnPq7R + R+ekmhosFoZ7IgohAkj9k8j6l4ipCc6yVN2M8TN1TfTwRC01vzz+SRYOXZWLNb0eqZzh + Zp2A== +ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; + s=arc-20160816; + h=sender:errors-to:content-transfer-encoding:cc:reply-to + :list-subscribe:list-help:list-post:list-archive:list-unsubscribe + :list-id:precedence:subject:feedback-id:mime-version:references + :in-reply-to:message-id:date:to:from:delivered-to; + bh=J5hIt8/6l7983HWQOAGA1qy6mjWmMWu6DJ2RZRfJeuQ=; + b=rX88kWHJtUiqnNutEQCOwUvfl5lV/FVHviaDHIsiatvB92XG71pgeFVXopTjJ+st3F + lu+/rKnYKAVXFqF4WHMP6bu0VT5bFE2A9806gTD5Rf1D2yGVjKWRH8fhY6Jl2KhEhQA+ + Efc6fMZ2qZRmdx5S2INE2k+sY3zgWZsFkv2NDowFLnjnpmTGneVW82ybCbL06DRH7Jts + wxWDfFfTqnp2VNwD0C462f5ogLB8cH7f9uoFviTovEYcXc8iLpHP38cJa3hdAuJg972S + cgjJSuZUaQ38bqmw7th2MDkaFSzryck0wafneRdJUxyKG7ltbwk4hgAz89yzUB7nZeU6 + yucA== +ARC-Authentication-Results: i=1; mx.google.com; + spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org + designates 79.124.17.100 as permitted sender) + smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org +Return-Path: +Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) + by mx.google.com with ESMTP id + gv41-20020a1709072be900b00965f171543esi11575148ejc.148.2023.05.15.01.33.40; + Mon, 15 May 2023 01:33:40 -0700 (PDT) +Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org + designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; +Authentication-Results: mx.google.com; + spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org + designates 79.124.17.100 as permitted sender) + smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org +Received: from [127.0.1.1] (localhost [127.0.0.1]) + by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id D65AD68C0A8; + Mon, 15 May 2023 11:33:29 +0300 (EEST) +X-Original-To: ffmpeg-devel@ffmpeg.org +Delivered-To: ffmpeg-devel@ffmpeg.org +Received: from bg4.exmail.qq.com (bg4.exmail.qq.com [43.155.67.158]) + by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 5AA6768C09F + for ; Mon, 15 May 2023 11:33:22 +0300 (EEST) +X-QQ-mid: bizesmtp75t1684139596t4okf86m +Received: from localhost ( [103.102.203.204]) by bizesmtp.qq.com (ESMTP) with + id ; Mon, 15 May 2023 16:33:15 +0800 (CST) +X-QQ-SSF: 01100000000000Z0Z000000A0000000 +X-QQ-FEAT: KvvwR/hcPA3wY6H84uX1Z4OhW9I2bQ1QV35znBz44h8GZ/oUuMaFpDcrT3dSg + MUkTVTMEyhXhHNx2JIMxfw5+q/3TCUtvnKXsxLZtQsy/0Nq/y+p0xVsHJzQmM8CvbT6L6Q3 + OmxwvGAO6ljvI/iA+SXU+3+HUNyetDE8UTRW1ZGCtG9iJRbK9wXPoiAMzLepT2+CHGO2brq + CwH6RA/e9/I4xOHLleywtC4oDlPuyHovxzzedsBTrXYic5tb0+D65abc6NjfHr7zrYD/DQu + HY0NNweX9YP/jE8jJ0TPLhcx7wighw+KDFbYf+UcUuaPHhzfAZh2f6aplibzVuvV78OPq2S + thQ/XeMGf/W9C/Oy4Eq145+G+pUQ7zx/OKY8Jj/33dmvwZkUr8= +X-QQ-GoodBg: 0 +X-BIZMAIL-ID: 9530387995930120932 +From: Steven Liu +To: ffmpeg-devel@ffmpeg.org +Date: Mon, 15 May 2023 16:31:59 +0800 +Message-Id: <20230515083201.48201-5-lq@chinaffmpeg.org> +X-Mailer: git-send-email 2.40.0 +In-Reply-To: <20230515083201.48201-1-lq@chinaffmpeg.org> +References: + + <20230515083201.48201-1-lq@chinaffmpeg.org> +MIME-Version: 1.0 +X-QQ-SENDSIZE: 520 +Feedback-ID: bizesmtp:chinaffmpeg.org:qybglogicsvrsz:qybglogicsvrsz3a-3 +Subject: [FFmpeg-devel] [PATCH v10 4/6] avformat/flvdec: support demux av1 + in enhanced flv +X-BeenThere: ffmpeg-devel@ffmpeg.org +X-Mailman-Version: 2.1.29 +Precedence: list +List-Id: FFmpeg development discussions and patches +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +Reply-To: FFmpeg development discussions and patches +Cc: Steven Liu +Errors-To: ffmpeg-devel-bounces@ffmpeg.org +Sender: "ffmpeg-devel" +X-TUID: MKqjViniwIy+ + +Signed-off-by: Steven Liu +--- + libavformat/flvdec.c | 12 ++++++++++-- + 1 file changed, 10 insertions(+), 2 deletions(-) + +diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c +index c8e6cadf1c..a0362ff11c 100644 +--- a/libavformat/flvdec.c ++++ b/libavformat/flvdec.c +@@ -318,6 +318,8 @@ static int flv_same_video_codec(AVFormatContext *s, AVCodecParameters *vpar, int + switch(codec_id) { + case MKBETAG('h', 'v', 'c', '1'): + return vpar->codec_id == AV_CODEC_ID_HEVC; ++ case MKBETAG('a', 'v', '0', '1'): ++ return vpar->codec_id == AV_CODEC_ID_AV1; + default: + break; + } +@@ -359,6 +361,10 @@ static int flv_set_video_codec(AVFormatContext *s, AVStream *vstream, + par->codec_id = AV_CODEC_ID_HEVC; + vstreami->need_parsing = AVSTREAM_PARSE_HEADERS; + return 4; ++ case MKBETAG('a', 'v', '0', '1'): ++ par->codec_id = AV_CODEC_ID_AV1; ++ vstreami->need_parsing = AVSTREAM_PARSE_HEADERS; ++ return 4; + default: + break; + } +@@ -1278,7 +1284,8 @@ retry_duration: + if (st->codecpar->codec_id == AV_CODEC_ID_AAC || + st->codecpar->codec_id == AV_CODEC_ID_H264 || + st->codecpar->codec_id == AV_CODEC_ID_MPEG4 || +- st->codecpar->codec_id == AV_CODEC_ID_HEVC) { ++ st->codecpar->codec_id == AV_CODEC_ID_HEVC || ++ st->codecpar->codec_id == AV_CODEC_ID_AV1) { + int type = 0; + if (flv->exheader && stream_type == FLV_STREAM_TYPE_VIDEO) { + type = flags & 0x0F; +@@ -1309,7 +1316,8 @@ retry_duration: + } + } + if (type == 0 && (!st->codecpar->extradata || st->codecpar->codec_id == AV_CODEC_ID_AAC || +- st->codecpar->codec_id == AV_CODEC_ID_H264 || st->codecpar->codec_id == AV_CODEC_ID_HEVC)) { ++ st->codecpar->codec_id == AV_CODEC_ID_H264 || st->codecpar->codec_id == AV_CODEC_ID_HEVC || ++ st->codecpar->codec_id == AV_CODEC_ID_AV1)) { + AVDictionaryEntry *t; + + if (st->codecpar->extradata) { + +From patchwork Mon May 15 08:32:00 2023 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +X-Patchwork-Submitter: Steven Liu +X-Patchwork-Id: 41619 +Delivered-To: ffmpegpatchwork2@gmail.com +Received: by 2002:a05:6a20:ba91:b0:105:feb:71f2 with SMTP id + fb17csp1444532pzb; + Mon, 15 May 2023 01:34:10 -0700 (PDT) +X-Google-Smtp-Source: + ACHHUZ4QlFqXMa0WNHK3Z3HLgPm2UskuQZX2wmbFhYm+ZL0BsDRPhLxJboG0YhDPFi999aVCQZE+ +X-Received: by 2002:a05:6402:14c3:b0:50d:fcfb:8633 with SMTP id + f3-20020a05640214c300b0050dfcfb8633mr9613789edx.9.1684139650196; + Mon, 15 May 2023 01:34:10 -0700 (PDT) +ARC-Seal: i=1; a=rsa-sha256; t=1684139650; cv=none; + d=google.com; s=arc-20160816; + b=sjfm4xhTPqjGNyHlxS3/kMPilx13EB+7S0YxjOI5lR9MMg8Sy3KgL187C6tuZqUwoZ + dJo7A3q41EK4WJyWTTUyqUOr8q8JPjbBTCJpVsERuMuMWpHrhQxvwEDibvfuDI0ZI2vK + y5pqRZ23OMNZLCC+fsc85gQDKPgvkYZTYisSOsWVRiZQGl04TipfZE1Uza8R7ZEXRgdH + ZW770YcfzVXmKKzralH4thSFhGfMZRpX7kj6oBtmpUco4Z6iu42o3iBTcaioGBzdWdPY + KL94WAIaMnCyO1JJaUAJGzEcQTGhPbXUzG7JvmqEwSa168GBSEjQJ3qJc8oOr+UVWcvn + HvaQ== +ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; + s=arc-20160816; + h=sender:errors-to:content-transfer-encoding:cc:reply-to + :list-subscribe:list-help:list-post:list-archive:list-unsubscribe + :list-id:precedence:subject:feedback-id:mime-version:references + :in-reply-to:message-id:date:to:from:delivered-to; + bh=b1Sp5oqZAMwakI7a3Zvw4MdnKPyomZo8cXqDnyJamjg=; + b=jcFJOli16NPqGPnMDcJVER3TEkWreNJ2Vu7711GhJhFkmXLNFhS2FUAoT9QBTy+JWm + jxaBjiVvs1MMQ+a3k3yT7AzVSUMMDDSagiE/jWzQ+vBN9dr/jQOMtJWxwfm4oTbBc0/r + GcHTgPKB2HvEiLOWaJ4CSfZcYBvosoew/IfPgKm06P2Btmc+faSXLCZ63nKEVTq7NCpx + qllJPkFmvlwB/+soxN7nZgTzXm/uurSOBMajImRGPOZUOZQE1I5Tk8OtJXZP6QtlSvXT + ZcglewhTYuHlAXbpT4sYyddMwKg9yPu6/Wmrol/wg3QpXPZ0lVtLeTozus/2UTISJrR5 + Lp3Q== +ARC-Authentication-Results: i=1; mx.google.com; + spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org + designates 79.124.17.100 as permitted sender) + smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org +Return-Path: +Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) + by mx.google.com with ESMTP id + f25-20020a056402151900b0050bd37278d9si11856925edw.435.2023.05.15.01.34.09; + Mon, 15 May 2023 01:34:10 -0700 (PDT) +Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org + designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; +Authentication-Results: mx.google.com; + spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org + designates 79.124.17.100 as permitted sender) + smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org +Received: from [127.0.1.1] (localhost [127.0.0.1]) + by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 0DB6568C092; + Mon, 15 May 2023 11:34:07 +0300 (EEST) +X-Original-To: ffmpeg-devel@ffmpeg.org +Delivered-To: ffmpeg-devel@ffmpeg.org +Received: from bg4.exmail.qq.com (bg4.exmail.qq.com [43.154.221.58]) + by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 96A14680274 + for ; Mon, 15 May 2023 11:33:59 +0300 (EEST) +X-QQ-mid: bizesmtp76t1684139634tg83beu0 +Received: from localhost ( [103.102.203.204]) by bizesmtp.qq.com (ESMTP) with + id ; Mon, 15 May 2023 16:33:52 +0800 (CST) +X-QQ-SSF: 01100000000000Z0Z000000A0000000 +X-QQ-FEAT: DWSCcwW/aQb83U5Bq9N00w3kkIuofNiUvlQbgR0sgGjFEas+vh7wXyRycFT/z + w33SH7uNRX8lmP+8+iy6jQH/gsaQRVAau2z8K0utdx9GuZMvY0e5SZfB0zBfncb1NdBZJxB + Ptvibavnj2rDlqrGLO9dvFEfmYj1K48HYp6rdjCb+xRPfyOtnct3Zq6ST7F1DxU1+Kmt8cw + 2qVgeA79DNHm1JbcDzi/2W/SpzWHWk/jamN4cAQfKyP9B4AvMPaFd8kdl6akYbR0Q84H73M + Pcx8UXz6iw4sCTSPFzf0zrsI4+shly9KFp4UESTfRbDEJ46pcyw8+6Uz+Q7w+7CRtPlOsms + K6IAbcLwicf/v8Rm2nHdrNPotcaMgY5p7IqmkY/Y/b2feqKiAM= +X-QQ-GoodBg: 0 +X-BIZMAIL-ID: 4611718483056789364 +From: Steven Liu +To: ffmpeg-devel@ffmpeg.org +Date: Mon, 15 May 2023 16:32:00 +0800 +Message-Id: <20230515083201.48201-6-lq@chinaffmpeg.org> +X-Mailer: git-send-email 2.40.0 +In-Reply-To: <20230515083201.48201-1-lq@chinaffmpeg.org> +References: + + <20230515083201.48201-1-lq@chinaffmpeg.org> +MIME-Version: 1.0 +X-QQ-SENDSIZE: 520 +Feedback-ID: bizesmtp:chinaffmpeg.org:qybglogicsvrsz:qybglogicsvrsz3a-3 +Subject: [FFmpeg-devel] [PATCH v10 5/6] avformat/flvenc: support mux vp9 in + enhanced flv +X-BeenThere: ffmpeg-devel@ffmpeg.org +X-Mailman-Version: 2.1.29 +Precedence: list +List-Id: FFmpeg development discussions and patches +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +Reply-To: FFmpeg development discussions and patches +Cc: Steven Liu +Errors-To: ffmpeg-devel-bounces@ffmpeg.org +Sender: "ffmpeg-devel" +X-TUID: appcyLUJeeFW + +Signed-off-by: Steven Liu +--- + libavformat/Makefile | 2 +- + libavformat/flvenc.c | 22 ++++++++++++++-------- + 2 files changed, 15 insertions(+), 9 deletions(-) + +diff --git a/libavformat/Makefile b/libavformat/Makefile +index c868e1626c..16cfe107ea 100644 +--- a/libavformat/Makefile ++++ b/libavformat/Makefile +@@ -214,7 +214,7 @@ OBJS-$(CONFIG_FLAC_MUXER) += flacenc.o flacenc_header.o \ + OBJS-$(CONFIG_FLIC_DEMUXER) += flic.o + OBJS-$(CONFIG_FLV_DEMUXER) += flvdec.o + OBJS-$(CONFIG_LIVE_FLV_DEMUXER) += flvdec.o +-OBJS-$(CONFIG_FLV_MUXER) += flvenc.o avc.o hevc.o av1.o ++OBJS-$(CONFIG_FLV_MUXER) += flvenc.o avc.o hevc.o av1.o vpcc.o + OBJS-$(CONFIG_FOURXM_DEMUXER) += 4xm.o + OBJS-$(CONFIG_FRAMECRC_MUXER) += framecrcenc.o framehash.o + OBJS-$(CONFIG_FRAMEHASH_MUXER) += hashenc.o framehash.o +diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c +index c1784b332d..475dd0bf44 100644 +--- a/libavformat/flvenc.c ++++ b/libavformat/flvenc.c +@@ -29,6 +29,7 @@ + #include "avio.h" + #include "avc.h" + #include "av1.h" ++#include "vpcc.h" + #include "hevc.h" + #include "avformat.h" + #include "flv.h" +@@ -50,6 +51,7 @@ static const AVCodecTag flv_video_codec_ids[] = { + { AV_CODEC_ID_H264, FLV_CODECID_H264 }, + { AV_CODEC_ID_HEVC, MKBETAG('h', 'v', 'c', '1') }, + { AV_CODEC_ID_AV1, MKBETAG('a', 'v', '0', '1') }, ++ { AV_CODEC_ID_VP9, MKBETAG('v', 'p', '0', '9') }, + { AV_CODEC_ID_NONE, 0 } + }; + +@@ -494,7 +496,7 @@ static void flv_write_codec_header(AVFormatContext* s, AVCodecParameters* par, i + + if (par->codec_id == AV_CODEC_ID_AAC || par->codec_id == AV_CODEC_ID_H264 + || par->codec_id == AV_CODEC_ID_MPEG4 || par->codec_id == AV_CODEC_ID_HEVC +- || par->codec_id == AV_CODEC_ID_AV1) { ++ || par->codec_id == AV_CODEC_ID_AV1 || par->codec_id == AV_CODEC_ID_VP9) { + int64_t pos; + avio_w8(pb, + par->codec_type == AVMEDIA_TYPE_VIDEO ? +@@ -540,9 +542,9 @@ static void flv_write_codec_header(AVFormatContext* s, AVCodecParameters* par, i + if (par->codec_id == AV_CODEC_ID_HEVC) { + avio_w8(pb, FLV_IS_EX_HEADER | PacketTypeSequenceStart); // ExVideoTagHeader mode with PacketTypeSequenceStart + avio_write(pb, "hvc1", 4); +- } else if (par->codec_id == AV_CODEC_ID_AV1) { ++ } else if (par->codec_id == AV_CODEC_ID_AV1 || par->codec_id == AV_CODEC_ID_VP9) { + avio_w8(pb, FLV_IS_EX_HEADER | PacketTypeSequenceStart); +- avio_write(pb, "av01", 4); ++ avio_write(pb, par->codec_id == AV_CODEC_ID_AV1 ? "av01" : "vp09", 4); + } else { + avio_w8(pb, par->codec_tag | FLV_FRAME_KEY); // flags + avio_w8(pb, 0); // AVC sequence header +@@ -553,6 +555,8 @@ static void flv_write_codec_header(AVFormatContext* s, AVCodecParameters* par, i + ff_isom_write_hvcc(pb, par->extradata, par->extradata_size, 0); + else if (par->codec_id == AV_CODEC_ID_AV1) + ff_isom_write_av1c(pb, par->extradata, par->extradata_size, 1); ++ else if (par->codec_id == AV_CODEC_ID_VP9) ++ ff_isom_write_vpcc(s, pb, par->extradata, par->extradata_size, par); + else + ff_isom_write_avcc(pb, par->extradata, par->extradata_size); + } +@@ -852,14 +856,15 @@ static int flv_write_packet(AVFormatContext *s, AVPacket *pkt) + par->codec_id == AV_CODEC_ID_VP6 || par->codec_id == AV_CODEC_ID_AAC) + flags_size = 2; + else if (par->codec_id == AV_CODEC_ID_H264 || par->codec_id == AV_CODEC_ID_MPEG4 || +- par->codec_id == AV_CODEC_ID_HEVC || par->codec_id == AV_CODEC_ID_AV1) ++ par->codec_id == AV_CODEC_ID_HEVC || par->codec_id == AV_CODEC_ID_AV1 || ++ par->codec_id == AV_CODEC_ID_VP9) + flags_size = 5; + else + flags_size = 1; + + if (par->codec_id == AV_CODEC_ID_AAC || par->codec_id == AV_CODEC_ID_H264 + || par->codec_id == AV_CODEC_ID_MPEG4 || par->codec_id == AV_CODEC_ID_HEVC +- || par->codec_id == AV_CODEC_ID_AV1) { ++ || par->codec_id == AV_CODEC_ID_AV1 || par->codec_id == AV_CODEC_ID_VP9) { + size_t side_size; + uint8_t *side = av_packet_get_side_data(pkt, AV_PKT_DATA_NEW_EXTRADATA, &side_size); + if (side && side_size > 0 && (side_size != par->extradata_size || memcmp(side, par->extradata, side_size))) { +@@ -880,7 +885,8 @@ static int flv_write_packet(AVFormatContext *s, AVPacket *pkt) + return AVERROR(EINVAL); + } + if (par->codec_id == AV_CODEC_ID_H264 || par->codec_id == AV_CODEC_ID_MPEG4 || +- par->codec_id == AV_CODEC_ID_HEVC || par->codec_id == AV_CODEC_ID_AV1) { ++ par->codec_id == AV_CODEC_ID_HEVC || par->codec_id == AV_CODEC_ID_AV1 || ++ par->codec_id == AV_CODEC_ID_VP9) { + if (pkt->pts == AV_NOPTS_VALUE) { + av_log(s, AV_LOG_ERROR, "Packet is missing PTS\n"); + return AVERROR(EINVAL); +@@ -993,9 +999,9 @@ static int flv_write_packet(AVFormatContext *s, AVPacket *pkt) + if (par->codec_id == AV_CODEC_ID_HEVC) { + avio_w8(pb, FLV_IS_EX_HEADER | PacketTypeCodedFramesX); // ExVideoTagHeader mode with PacketTypeCodedFramesX + avio_write(pb, "hvc1", 4); +- } else if (par->codec_id == AV_CODEC_ID_AV1) { ++ } else if (par->codec_id == AV_CODEC_ID_AV1 || par->codec_id == AV_CODEC_ID_VP9) { + avio_w8(pb, FLV_IS_EX_HEADER | PacketTypeCodedFrames); +- avio_write(pb, "av01", 4); ++ avio_write(pb, par->codec_id == AV_CODEC_ID_AV1 ? "av01" : "vp09", 4); + } else { + avio_w8(pb, flags); + } + +From patchwork Mon May 15 08:32:01 2023 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +X-Patchwork-Submitter: Steven Liu +X-Patchwork-Id: 41620 +Delivered-To: ffmpegpatchwork2@gmail.com +Received: by 2002:a05:6a20:ba91:b0:105:feb:71f2 with SMTP id + fb17csp1444616pzb; + Mon, 15 May 2023 01:34:19 -0700 (PDT) +X-Google-Smtp-Source: + ACHHUZ4K6eOJwwn7jPfy0dhTP4IQr2XzDB8PfB7Er6aQtrCrxnddiRIgdBqZB72dHhyqfbILXd5E +X-Received: by 2002:a17:906:ee8e:b0:95e:c549:9ace with SMTP id + wt14-20020a170906ee8e00b0095ec5499acemr28082182ejb.62.1684139659496; + Mon, 15 May 2023 01:34:19 -0700 (PDT) +ARC-Seal: i=1; a=rsa-sha256; t=1684139659; cv=none; + d=google.com; s=arc-20160816; + b=FM9SQbkYmqWaOAa8YRKsdoj3BSoNN/SsDqXgEaRL8lCygJuahCT1ybocV1IqmUSTxS + l5AcUJGbZbl2BeNhK5mX43aCfKBSSF3DLhmRCMBC8pU2iPmv7TuSV58kRfLY6r83j8Ic + dV56QUYYtN+Ve0BWnaHFOzivSNAgHxwePstQL043LHD2rn+B5CyNvq7l2CahnhMJ8JUG + zJNSBe/LFF0Lhkymqd877vkJ+x+UjSWEIdomIJdAcAt2D06jDxwIF/nnLDDHmvQeny2N + 8xqssE401QcYCq6GtRi0UTAyMrYiDU4RUPOh8Kjb5YoMXYpbI+BCsr6VJlh6/F6cFD58 + YStw== +ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; + s=arc-20160816; + h=sender:errors-to:content-transfer-encoding:cc:reply-to + :list-subscribe:list-help:list-post:list-archive:list-unsubscribe + :list-id:precedence:subject:feedback-id:mime-version:references + :in-reply-to:message-id:date:to:from:delivered-to; + bh=JCKfqtynP85UyN4OG5PQuC2GOM45EC75rPa/TN9Pkis=; + b=MF78hg+0KkjUNq5Bjz6b4rjcJDJqrFufWHhDWzKgWCGo15fvnVg3UY8PDvpsUYxxSA + SXQJP1urvuxLvJ9m6N20/mBCgrN9Cqca537oiWWNbayAOBLuihXPNDPZLqYgD9yg+03U + Qo46rKs8BxkuzTKsqfFu1cf8b3qgqp2wt2mOFFnRU8p9J5foA5HCpHoEB1SWo8KqKjqz + NeFoyh4k/CHk8Qy2rhQ/ahuNo0zByXEVuGqBEK1GakW8bC6DpX/gX9PnsE7BvpOrO/+z + iEJxUd1RyUFDRETjdcqfLeRlEBO0NbFi9GTRjg0oY7m2OM8gh9zw7TIOoKfKaCVepa+1 + zs+g== +ARC-Authentication-Results: i=1; mx.google.com; + spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org + designates 79.124.17.100 as permitted sender) + smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org +Return-Path: +Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) + by mx.google.com with ESMTP id + f21-20020a170906825500b00965c55c71d9si10492876ejx.988.2023.05.15.01.34.19; + Mon, 15 May 2023 01:34:19 -0700 (PDT) +Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org + designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; +Authentication-Results: mx.google.com; + spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org + designates 79.124.17.100 as permitted sender) + smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org +Received: from [127.0.1.1] (localhost [127.0.0.1]) + by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 3486468C072; + Mon, 15 May 2023 11:34:13 +0300 (EEST) +X-Original-To: ffmpeg-devel@ffmpeg.org +Delivered-To: ffmpeg-devel@ffmpeg.org +Received: from bg4.exmail.qq.com (bg4.exmail.qq.com [43.154.221.58]) + by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 6482B68C0A0 + for ; Mon, 15 May 2023 11:34:05 +0300 (EEST) +X-QQ-mid: bizesmtp71t1684139639tsfp6osq +Received: from localhost ( [103.102.203.204]) by bizesmtp.qq.com (ESMTP) with + id ; Mon, 15 May 2023 16:33:58 +0800 (CST) +X-QQ-SSF: 01100000000000Z0Z000000A0000000 +X-QQ-FEAT: v2TBAhtyi5HmOI8RH62YXWVaml0uNXxcsJwtXrqVzXdpJwJpkYcpKS0jOn5b8 + vputCYK1FNClBNOmv9AzELjT/K26cFOsUYKBpAudrf8Al/Kmwl8CjyT6nDK06QByrHu67A4 + sX8VQrazIXO6ZPIrfA9ElusXtssmR22e8ju0nXX7oNy/AS4t0bZkuJRVmYCoHSCnLqnvF9r + YboVdmg0ZbLovrXBy26bgQr944G/tQRTeAGorAwE61Lf9tqlRKuT8TO8/BA/V7zBuaZTSxA + nghl61awPoduY4vd9Nepw43V2Cun4wfPTvAMJn9EQhrdUge4sIN0Q4EuWkBd9dC/nTOwVKV + WsjLxbyL6apFe08XmyeS9MDJkL+bFN3ykpDJqblBg8C1AYOjVyYFS2Yt/atcQ== +X-QQ-GoodBg: 0 +X-BIZMAIL-ID: 14221595051603022987 +From: Steven Liu +To: ffmpeg-devel@ffmpeg.org +Date: Mon, 15 May 2023 16:32:01 +0800 +Message-Id: <20230515083201.48201-7-lq@chinaffmpeg.org> +X-Mailer: git-send-email 2.40.0 +In-Reply-To: <20230515083201.48201-1-lq@chinaffmpeg.org> +References: + + <20230515083201.48201-1-lq@chinaffmpeg.org> +MIME-Version: 1.0 +X-QQ-SENDSIZE: 520 +Feedback-ID: bizesmtp:chinaffmpeg.org:qybglogicsvrsz:qybglogicsvrsz3a-3 +Subject: [FFmpeg-devel] [PATCH v10 6/6] avformat/flvdec: support demux vp9 + in enhanced flv +X-BeenThere: ffmpeg-devel@ffmpeg.org +X-Mailman-Version: 2.1.29 +Precedence: list +List-Id: FFmpeg development discussions and patches +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +Reply-To: FFmpeg development discussions and patches +Cc: Steven Liu +Errors-To: ffmpeg-devel-bounces@ffmpeg.org +Sender: "ffmpeg-devel" +X-TUID: wOtvTzk+zhdw + +Signed-off-by: Steven Liu +--- + libavformat/flvdec.c | 11 +++++++++-- + 1 file changed, 9 insertions(+), 2 deletions(-) + +diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c +index a0362ff11c..a6a94a4021 100644 +--- a/libavformat/flvdec.c ++++ b/libavformat/flvdec.c +@@ -320,6 +320,8 @@ static int flv_same_video_codec(AVFormatContext *s, AVCodecParameters *vpar, int + return vpar->codec_id == AV_CODEC_ID_HEVC; + case MKBETAG('a', 'v', '0', '1'): + return vpar->codec_id == AV_CODEC_ID_AV1; ++ case MKBETAG('v', 'p', '0', '9'): ++ return vpar->codec_id == AV_CODEC_ID_VP9; + default: + break; + } +@@ -365,6 +367,10 @@ static int flv_set_video_codec(AVFormatContext *s, AVStream *vstream, + par->codec_id = AV_CODEC_ID_AV1; + vstreami->need_parsing = AVSTREAM_PARSE_HEADERS; + return 4; ++ case MKBETAG('v', 'p', '0', '9'): ++ par->codec_id = AV_CODEC_ID_VP9; ++ vstreami->need_parsing = AVSTREAM_PARSE_HEADERS; ++ return 4; + default: + break; + } +@@ -1285,7 +1291,8 @@ retry_duration: + st->codecpar->codec_id == AV_CODEC_ID_H264 || + st->codecpar->codec_id == AV_CODEC_ID_MPEG4 || + st->codecpar->codec_id == AV_CODEC_ID_HEVC || +- st->codecpar->codec_id == AV_CODEC_ID_AV1) { ++ st->codecpar->codec_id == AV_CODEC_ID_AV1 || ++ st->codecpar->codec_id == AV_CODEC_ID_VP9) { + int type = 0; + if (flv->exheader && stream_type == FLV_STREAM_TYPE_VIDEO) { + type = flags & 0x0F; +@@ -1317,7 +1324,7 @@ retry_duration: + } + if (type == 0 && (!st->codecpar->extradata || st->codecpar->codec_id == AV_CODEC_ID_AAC || + st->codecpar->codec_id == AV_CODEC_ID_H264 || st->codecpar->codec_id == AV_CODEC_ID_HEVC || +- st->codecpar->codec_id == AV_CODEC_ID_AV1)) { ++ st->codecpar->codec_id == AV_CODEC_ID_AV1 || st->codecpar->codec_id == AV_CODEC_ID_VP9)) { + AVDictionaryEntry *t; + + if (st->codecpar->extradata) { diff --git a/enable_decoders b/enable_decoders index 296c3a3..ea1c38e 100644 --- a/enable_decoders +++ b/enable_decoders @@ -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 diff --git a/enable_encoders b/enable_encoders index e0f3cfb..10dd53a 100644 --- a/enable_encoders +++ b/enable_encoders @@ -30,6 +30,7 @@ asv2 av1_amf av1_nvenc av1_qsv +av1_vaapi ayuv # trival bitpacked # trivial bmp # trivial diff --git a/ffmpeg-ge-av1-vaapi-encode-support.patch b/ffmpeg-ge-av1-vaapi-encode-support.patch new file mode 100644 index 0000000..6ae8258 --- /dev/null +++ b/ffmpeg-ge-av1-vaapi-encode-support.patch @@ -0,0 +1,3984 @@ +From 7c2ea45053b7a3d4193bb0abb9c0f3b0cdbeec7a Mon Sep 17 00:00:00 2001 +From: GloriousEggroll +Date: Thu, 9 Nov 2023 17:51:19 -0700 +Subject: [PATCH] backport av1 encode support + +Adapted from https://patchwork.ffmpeg.org/project/ffmpeg/list/?series=9594 + +--- + configure | 3 + + doc/encoders.texi | 14 + + libavcodec/Makefile | 2 + + libavcodec/allcodecs.c | 1 + + libavcodec/av1.h | 7 + + libavcodec/av1_levels.c | 92 +++ + libavcodec/av1_levels.h | 58 ++ + libavcodec/cbs.c | 155 +++-- + libavcodec/cbs.h | 88 ++- + libavcodec/cbs_av1.c | 262 +++----- + libavcodec/cbs_av1.h | 1 + + libavcodec/cbs_av1_syntax_template.c | 4 +- + libavcodec/cbs_bsf.c | 5 + + libavcodec/cbs_h2645.c | 149 ++--- + libavcodec/cbs_internal.h | 96 ++- + libavcodec/cbs_mpeg2.c | 15 +- + libavcodec/cbs_vp9.c | 122 ++-- + libavcodec/extract_extradata_bsf.c | 7 +- + libavcodec/trace_headers_bsf.c | 2 + + libavcodec/vaapi_encode.c | 370 ++++++++--- + libavcodec/vaapi_encode.h | 39 +- + libavcodec/vaapi_encode_av1.c | 949 +++++++++++++++++++++++++++ + libavcodec/vaapi_encode_h264.c | 94 +-- + libavcodec/vaapi_encode_h265.c | 76 ++- + libavcodec/vaapi_encode_mpeg2.c | 6 +- + libavcodec/vaapi_encode_vp8.c | 6 +- + libavcodec/vaapi_encode_vp9.c | 26 +- + 27 files changed, 2054 insertions(+), 595 deletions(-) + create mode 100644 libavcodec/av1_levels.c + create mode 100644 libavcodec/av1_levels.h + create mode 100644 libavcodec/vaapi_encode_av1.c + +diff --git a/configure b/configure +index b6616f0..f5a91b6 100755 +--- a/configure ++++ b/configure +@@ -3259,6 +3259,8 @@ av1_qsv_decoder_select="qsvdec" + av1_qsv_encoder_select="qsvenc" + av1_qsv_encoder_deps="libvpl" + av1_amf_encoder_deps="amf" ++av1_vaapi_encoder_deps="VAEncPictureParameterBufferAV1" ++av1_vaapi_encoder_select="cbs_av1 vaapi_encode" + + # parsers + aac_parser_select="adts_header mpeg4audio" +@@ -6973,6 +6975,7 @@ if enabled vaapi; then + check_type "va/va.h va/va_enc_jpeg.h" "VAEncPictureParameterBufferJPEG" + check_type "va/va.h va/va_enc_vp8.h" "VAEncPictureParameterBufferVP8" + check_type "va/va.h va/va_enc_vp9.h" "VAEncPictureParameterBufferVP9" ++ check_type "va/va.h va/va_enc_av1.h" "VAEncPictureParameterBufferAV1" + fi + + if enabled_all opencl libdrm ; then +diff --git a/doc/encoders.texi b/doc/encoders.texi +index b02737b..994e27f 100644 +--- a/doc/encoders.texi ++++ b/doc/encoders.texi +@@ -3965,6 +3965,20 @@ Average variable bitrate. + Each encoder also has its own specific options: + @table @option + ++@item av1_vaapi ++@option{profile} sets the value of @emph{seq_profile}. ++@option{tier} sets the value of @emph{seq_tier}. ++@option{level} sets the value of @emph{seq_level_idx}. ++ ++@table @option ++@item tiles ++Set the number of tiles to encode the input video with, as columns x rows. ++(default is auto, which means use minimal tile column/row number). ++@item tile_groups ++Set tile groups number. All the tiles will be distributed as evenly as possible to ++each tile group. (default is 1). ++@end table ++ + @item h264_vaapi + @option{profile} sets the value of @emph{profile_idc} and the @emph{constraint_set*_flag}s. + @option{level} sets the value of @emph{level_idc}. +diff --git a/libavcodec/Makefile b/libavcodec/Makefile +index 389253f..5f620e6 100644 +--- a/libavcodec/Makefile ++++ b/libavcodec/Makefile +@@ -255,6 +255,7 @@ OBJS-$(CONFIG_AV1_CUVID_DECODER) += cuviddec.o + OBJS-$(CONFIG_AV1_MEDIACODEC_DECODER) += mediacodecdec.o + OBJS-$(CONFIG_AV1_NVENC_ENCODER) += nvenc_av1.o nvenc.o + OBJS-$(CONFIG_AV1_QSV_ENCODER) += qsvenc_av1.o ++OBJS-$(CONFIG_AV1_VAAPI_ENCODER) += vaapi_encode_av1.o av1_levels.o + OBJS-$(CONFIG_AVRN_DECODER) += avrndec.o + OBJS-$(CONFIG_AVRP_DECODER) += r210dec.o + OBJS-$(CONFIG_AVRP_ENCODER) += r210enc.o +@@ -1298,6 +1299,7 @@ TESTPROGS = avcodec \ + jpeg2000dwt \ + mathops \ + ++TESTPROGS-$(CONFIG_AV1_VAAPI_ENCODER) += av1_levels + TESTPROGS-$(CONFIG_CABAC) += cabac + TESTPROGS-$(CONFIG_DCT) += avfft + TESTPROGS-$(CONFIG_FFT) += fft fft-fixed32 +diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c +index e593ad1..4706fc3 100644 +--- a/libavcodec/allcodecs.c ++++ b/libavcodec/allcodecs.c +@@ -838,6 +838,7 @@ extern const FFCodec ff_av1_nvenc_encoder; + extern const FFCodec ff_av1_qsv_decoder; + extern const FFCodec ff_av1_qsv_encoder; + extern const FFCodec ff_av1_amf_encoder; ++extern const FFCodec ff_av1_vaapi_encoder; + extern const FFCodec ff_libopenh264_encoder; + extern const FFCodec ff_libopenh264_decoder; + extern const FFCodec ff_h264_amf_encoder; +diff --git a/libavcodec/av1.h b/libavcodec/av1.h +index 384f7cd..8704bc4 100644 +--- a/libavcodec/av1.h ++++ b/libavcodec/av1.h +@@ -175,6 +175,13 @@ enum { + AV1_RESTORE_SWITCHABLE = 3, + }; + ++// TX mode (section 6.8.21) ++enum { ++ AV1_ONLY_4X4 = 0, ++ AV1_TX_MODE_LARGEST = 1, ++ AV1_TX_MODE_SELECT = 2, ++}; ++ + // Sequence Headers are actually unbounded because one can use + // an arbitrary number of leading zeroes when encoding via uvlc. + // The following estimate is based around using the lowest number +diff --git a/libavcodec/av1_levels.c b/libavcodec/av1_levels.c +new file mode 100644 +index 0000000..19b6ee1 +--- /dev/null ++++ b/libavcodec/av1_levels.c +@@ -0,0 +1,92 @@ ++/* ++ * Copyright (c) 2023 Intel Corporation ++ * ++ * This file is part of FFmpeg. ++ * ++ * FFmpeg is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * FFmpeg is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with FFmpeg; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ */ ++ ++#include ++#include "libavutil/macros.h" ++#include "av1_levels.h" ++ ++/** ignore entries which named in spec but no details. Like level 2.2 and 7.0. */ ++static const AV1LevelDescriptor av1_levels[] = { ++ // Name MaxVSize MainMbps MaxTiles ++ // | level_idx | MaxDisplayRate | HighMbps | MaxTileCols ++ // | | MaxPicSize | | MaxDecodeRate | | MainCR | | ++ // | | | MaxHSize | | | MaxHeaderRate | | | HighCR| | ++ // | | | | | | | | | | | | | | ++ { "2.0", 0, 147456, 2048, 1152, 4423680, 5529600, 150, 1.5, 0, 2, 0, 8, 4 }, ++ { "2.1", 1, 278784, 2816, 1584, 8363520, 10454400, 150, 3.0, 0, 2, 0, 8, 4 }, ++ { "3.0", 4, 665856, 4352, 2448, 19975680, 24969600, 150, 6.0, 0, 2, 0, 16, 6 }, ++ { "3.1", 5, 1065024, 5504, 3096, 31950720, 39938400, 150, 10.0, 0, 2, 0, 16, 6 }, ++ { "4.0", 8, 2359296, 6144, 3456, 70778880, 77856768, 300, 12.0, 30.0, 4, 4, 32, 8 }, ++ { "4.1", 9, 2359296, 6144, 3456, 141557760, 155713536, 300, 20.0, 50.0, 4, 4, 32, 8 }, ++ { "5.0", 12, 8912896, 8192, 4352, 267386880, 273715200, 300, 30.0, 100.0, 6, 4, 64, 8 }, ++ { "5.1", 13, 8912896, 8192, 4352, 534773760, 547430400, 300, 40.0, 160.0, 8, 4, 64, 8 }, ++ { "5.2", 14, 8912896, 8192, 4352, 1069547520, 1094860800, 300, 60.0, 240.0, 8, 4, 64, 8 }, ++ { "5.3", 15, 8912896, 8192, 4352, 1069547520, 1176502272, 300, 60.0, 240.0, 8, 4, 64, 8 }, ++ { "6.0", 16, 35651584, 16384, 8704, 1069547520, 1176502272, 300, 60.0, 240.0, 8, 4, 128, 16 }, ++ { "6.1", 17, 35651584, 16384, 8704, 2139095040, 2189721600, 300, 100.0, 480.0, 8, 4, 128, 16 }, ++ { "6.2", 18, 35651584, 16384, 8704, 4278190080, 4379443200, 300, 160.0, 800.0, 8, 4, 128, 16 }, ++ { "6.3", 19, 35651584, 16384, 8704, 4278190080, 4706009088, 300, 160.0, 800.0, 8, 4, 128, 16 }, ++}; ++ ++const AV1LevelDescriptor *ff_av1_guess_level(int64_t bitrate, ++ int tier, ++ int width, ++ int height, ++ int tiles, ++ int tile_cols, ++ float fps) ++{ ++ int pic_size; ++ uint64_t display_rate; ++ float max_br; ++ ++ pic_size = width * height; ++ display_rate = (uint64_t)pic_size * fps; ++ ++ for (int i = 0; i < FF_ARRAY_ELEMS(av1_levels); i++) { ++ const AV1LevelDescriptor *level = &av1_levels[i]; ++ // Limitation: decode rate, header rate, compress rate, etc. are not considered. ++ if (pic_size > level->max_pic_size) ++ continue; ++ if (width > level->max_h_size) ++ continue; ++ if (height > level->max_v_size) ++ continue; ++ if (display_rate > level->max_display_rate) ++ continue; ++ ++ if (tier) ++ max_br = level->high_mbps; ++ else ++ max_br = level->main_mbps; ++ if (!max_br) ++ continue; ++ if (bitrate > (int64_t)(1000000.0 * max_br)) ++ continue; ++ ++ if (tiles > level->max_tiles) ++ continue; ++ if (tile_cols > level->max_tile_cols) ++ continue; ++ return level; ++ } ++ ++ return NULL; ++} +diff --git a/libavcodec/av1_levels.h b/libavcodec/av1_levels.h +new file mode 100644 +index 0000000..164cb87 +--- /dev/null ++++ b/libavcodec/av1_levels.h +@@ -0,0 +1,58 @@ ++/* ++ * Copyright (c) 2023 Intel Corporation ++ * ++ * This file is part of FFmpeg. ++ * ++ * FFmpeg is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * FFmpeg is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with FFmpeg; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ */ ++ ++#ifndef AVCODEC_AV1_LEVELS_H ++#define AVCODEC_AV1_LEVELS_H ++ ++#include ++ ++typedef struct AV1LevelDescriptor { ++ char name[4]; ++ uint8_t level_idx; ++ ++ uint32_t max_pic_size; ++ uint32_t max_h_size; ++ uint32_t max_v_size; ++ uint64_t max_display_rate; ++ uint64_t max_decode_rate; ++ ++ uint32_t max_header_rate; ++ float main_mbps; ++ float high_mbps; ++ uint32_t main_cr; ++ uint32_t high_cr; ++ uint32_t max_tiles; ++ uint32_t max_tile_cols; ++} AV1LevelDescriptor; ++ ++/** ++ * Guess the level of a stream from some parameters. ++ * ++ * Unknown parameters may be zero, in which case they will be ignored. ++ */ ++const AV1LevelDescriptor *ff_av1_guess_level(int64_t bitrate, ++ int tier, ++ int width, ++ int height, ++ int tile_rows, ++ int tile_cols, ++ float fps); ++ ++#endif /* AVCODEC_AV1_LEVELS_H */ +diff --git a/libavcodec/cbs.c b/libavcodec/cbs.c +index 504197e..64b9aee 100644 +--- a/libavcodec/cbs.c ++++ b/libavcodec/cbs.c +@@ -111,8 +111,9 @@ av_cold int ff_cbs_init(CodedBitstreamContext **ctx_ptr, + + ctx->decompose_unit_types = NULL; + +- ctx->trace_enable = 0; +- ctx->trace_level = AV_LOG_TRACE; ++ ctx->trace_enable = 0; ++ ctx->trace_level = AV_LOG_TRACE; ++ ctx->trace_context = ctx; + + *ctx_ptr = ctx; + return 0; +@@ -490,19 +491,27 @@ void ff_cbs_trace_header(CodedBitstreamContext *ctx, + av_log(ctx->log_ctx, ctx->trace_level, "%s\n", name); + } + +-void ff_cbs_trace_syntax_element(CodedBitstreamContext *ctx, int position, +- const char *str, const int *subscripts, +- const char *bits, int64_t value) ++void ff_cbs_trace_read_log(void *trace_context, ++ GetBitContext *gbc, int length, ++ const char *str, const int *subscripts, ++ int64_t value) + { ++ CodedBitstreamContext *ctx = trace_context; + char name[256]; ++ char bits[256]; + size_t name_len, bits_len; + int pad, subs, i, j, k, n; +- +- if (!ctx->trace_enable) +- return; ++ int position; + + av_assert0(value >= INT_MIN && value <= UINT32_MAX); + ++ position = get_bits_count(gbc); ++ ++ av_assert0(length < 256); ++ for (i = 0; i < length; i++) ++ bits[i] = get_bits1(gbc) ? '1' : '0'; ++ bits[length] = 0; ++ + subs = subscripts ? subscripts[0] : 0; + n = 0; + for (i = j = 0; str[i];) { +@@ -529,7 +538,7 @@ void ff_cbs_trace_syntax_element(CodedBitstreamContext *ctx, int position, + av_assert0(n == subs); + + name_len = strlen(name); +- bits_len = strlen(bits); ++ bits_len = length; + + if (name_len + bits_len > 60) + pad = bits_len + 2; +@@ -540,14 +549,48 @@ void ff_cbs_trace_syntax_element(CodedBitstreamContext *ctx, int position, + position, name, pad, bits, value); + } + +-int ff_cbs_read_unsigned(CodedBitstreamContext *ctx, GetBitContext *gbc, +- int width, const char *name, +- const int *subscripts, uint32_t *write_to, +- uint32_t range_min, uint32_t range_max) ++void ff_cbs_trace_write_log(void *trace_context, ++ PutBitContext *pbc, int length, ++ const char *str, const int *subscripts, ++ int64_t value) + { +- uint32_t value; ++ CodedBitstreamContext *ctx = trace_context; ++ ++ // Ensure that the syntax element is written to the output buffer, ++ // make a GetBitContext pointed at the start position, then call the ++ // read log function which can read the bits back to log them. ++ ++ GetBitContext gbc; + int position; + ++ if (length > 0) { ++ PutBitContext flush; ++ flush = *pbc; ++ flush_put_bits(&flush); ++ } ++ ++ position = put_bits_count(pbc); ++ av_assert0(position >= length); ++ ++ init_get_bits(&gbc, pbc->buf, position); ++ ++ skip_bits_long(&gbc, position - length); ++ ++ ff_cbs_trace_read_log(ctx, &gbc, length, str, subscripts, value); ++} ++ ++static av_always_inline int cbs_read_unsigned(CodedBitstreamContext *ctx, ++ GetBitContext *gbc, ++ int width, const char *name, ++ const int *subscripts, ++ uint32_t *write_to, ++ uint32_t range_min, ++ uint32_t range_max) ++{ ++ uint32_t value; ++ ++ CBS_TRACE_READ_START(); ++ + av_assert0(width > 0 && width <= 32); + + if (get_bits_left(gbc) < width) { +@@ -556,21 +599,9 @@ int ff_cbs_read_unsigned(CodedBitstreamContext *ctx, GetBitContext *gbc, + return AVERROR_INVALIDDATA; + } + +- if (ctx->trace_enable) +- position = get_bits_count(gbc); +- + value = get_bits_long(gbc, width); + +- if (ctx->trace_enable) { +- char bits[33]; +- int i; +- for (i = 0; i < width; i++) +- bits[i] = value >> (width - i - 1) & 1 ? '1' : '0'; +- bits[i] = 0; +- +- ff_cbs_trace_syntax_element(ctx, position, name, subscripts, +- bits, value); +- } ++ CBS_TRACE_READ_END(); + + if (value < range_min || value > range_max) { + av_log(ctx->log_ctx, AV_LOG_ERROR, "%s out of range: " +@@ -583,11 +614,29 @@ int ff_cbs_read_unsigned(CodedBitstreamContext *ctx, GetBitContext *gbc, + return 0; + } + ++int ff_cbs_read_unsigned(CodedBitstreamContext *ctx, GetBitContext *gbc, ++ int width, const char *name, ++ const int *subscripts, uint32_t *write_to, ++ uint32_t range_min, uint32_t range_max) ++{ ++ return cbs_read_unsigned(ctx, gbc, width, name, subscripts, ++ write_to, range_min, range_max); ++} ++ ++int ff_cbs_read_simple_unsigned(CodedBitstreamContext *ctx, GetBitContext *gbc, ++ int width, const char *name, uint32_t *write_to) ++{ ++ return cbs_read_unsigned(ctx, gbc, width, name, NULL, ++ write_to, 0, UINT32_MAX); ++} ++ + int ff_cbs_write_unsigned(CodedBitstreamContext *ctx, PutBitContext *pbc, + int width, const char *name, + const int *subscripts, uint32_t value, + uint32_t range_min, uint32_t range_max) + { ++ CBS_TRACE_WRITE_START(); ++ + av_assert0(width > 0 && width <= 32); + + if (value < range_min || value > range_max) { +@@ -600,32 +649,31 @@ int ff_cbs_write_unsigned(CodedBitstreamContext *ctx, PutBitContext *pbc, + if (put_bits_left(pbc) < width) + return AVERROR(ENOSPC); + +- if (ctx->trace_enable) { +- char bits[33]; +- int i; +- for (i = 0; i < width; i++) +- bits[i] = value >> (width - i - 1) & 1 ? '1' : '0'; +- bits[i] = 0; +- +- ff_cbs_trace_syntax_element(ctx, put_bits_count(pbc), +- name, subscripts, bits, value); +- } +- + if (width < 32) + put_bits(pbc, width, value); + else + put_bits32(pbc, value); + ++ CBS_TRACE_WRITE_END(); ++ + return 0; + } + ++int ff_cbs_write_simple_unsigned(CodedBitstreamContext *ctx, PutBitContext *pbc, ++ int width, const char *name, uint32_t value) ++{ ++ return ff_cbs_write_unsigned(ctx, pbc, width, name, NULL, ++ value, 0, MAX_UINT_BITS(width)); ++} ++ + int ff_cbs_read_signed(CodedBitstreamContext *ctx, GetBitContext *gbc, + int width, const char *name, + const int *subscripts, int32_t *write_to, + int32_t range_min, int32_t range_max) + { + int32_t value; +- int position; ++ ++ CBS_TRACE_READ_START(); + + av_assert0(width > 0 && width <= 32); + +@@ -635,21 +683,9 @@ int ff_cbs_read_signed(CodedBitstreamContext *ctx, GetBitContext *gbc, + return AVERROR_INVALIDDATA; + } + +- if (ctx->trace_enable) +- position = get_bits_count(gbc); +- + value = get_sbits_long(gbc, width); + +- if (ctx->trace_enable) { +- char bits[33]; +- int i; +- for (i = 0; i < width; i++) +- bits[i] = value & (1U << (width - i - 1)) ? '1' : '0'; +- bits[i] = 0; +- +- ff_cbs_trace_syntax_element(ctx, position, name, subscripts, +- bits, value); +- } ++ CBS_TRACE_READ_END(); + + if (value < range_min || value > range_max) { + av_log(ctx->log_ctx, AV_LOG_ERROR, "%s out of range: " +@@ -667,6 +703,8 @@ int ff_cbs_write_signed(CodedBitstreamContext *ctx, PutBitContext *pbc, + const int *subscripts, int32_t value, + int32_t range_min, int32_t range_max) + { ++ CBS_TRACE_WRITE_START(); ++ + av_assert0(width > 0 && width <= 32); + + if (value < range_min || value > range_max) { +@@ -679,22 +717,13 @@ int ff_cbs_write_signed(CodedBitstreamContext *ctx, PutBitContext *pbc, + if (put_bits_left(pbc) < width) + return AVERROR(ENOSPC); + +- if (ctx->trace_enable) { +- char bits[33]; +- int i; +- for (i = 0; i < width; i++) +- bits[i] = value & (1U << (width - i - 1)) ? '1' : '0'; +- bits[i] = 0; +- +- ff_cbs_trace_syntax_element(ctx, put_bits_count(pbc), +- name, subscripts, bits, value); +- } +- + if (width < 32) + put_sbits(pbc, width, value); + else + put_bits32(pbc, value); + ++ CBS_TRACE_WRITE_END(); ++ + return 0; + } + +diff --git a/libavcodec/cbs.h b/libavcodec/cbs.h +index ee21623..f6509a2 100644 +--- a/libavcodec/cbs.h ++++ b/libavcodec/cbs.h +@@ -167,6 +167,51 @@ typedef struct CodedBitstreamFragment { + CodedBitstreamUnit *units; + } CodedBitstreamFragment; + ++ ++struct CodedBitstreamContext; ++struct GetBitContext; ++struct PutBitContext; ++ ++/** ++ * Callback type for read tracing. ++ * ++ * @param ctx User-set trace context. ++ * @param gbc A GetBitContext set at the start of the syntax ++ * element. This is a copy, the callee does not ++ * need to preserve it. ++ * @param length Length in bits of the syntax element. ++ * @param name String name of the syntax elements. ++ * @param subscripts If the syntax element is an array, a pointer to ++ * an array of subscripts into the array. ++ * @param value Parsed value of the syntax element. ++ */ ++typedef void (*CBSTraceReadCallback)(void *trace_context, ++ struct GetBitContext *gbc, ++ int start_position, ++ const char *name, ++ const int *subscripts, ++ int64_t value); ++ ++/** ++ * Callback type for write tracing. ++ * ++ * @param ctx User-set trace context. ++ * @param pbc A PutBitContext set at the end of the syntax ++ * element. The user must not modify this, but may ++ * inspect it to determine state. ++ * @param length Length in bits of the syntax element. ++ * @param name String name of the syntax elements. ++ * @param subscripts If the syntax element is an array, a pointer to ++ * an array of subscripts into the array. ++ * @param value Written value of the syntax element. ++ */ ++typedef void (*CBSTraceWriteCallback)(void *trace_context, ++ struct PutBitContext *pbc, ++ int start_position, ++ const char *name, ++ const int *subscripts, ++ int64_t value); ++ + /** + * Context structure for coded bitstream operations. + */ +@@ -210,11 +255,29 @@ typedef struct CodedBitstreamContext { + */ + int trace_enable; + /** +- * Log level to use for trace output. ++ * Log level to use for default trace output. + * + * From AV_LOG_*; defaults to AV_LOG_TRACE. + */ + int trace_level; ++ /** ++ * User context pointer to pass to trace callbacks. ++ */ ++ void *trace_context; ++ /** ++ * Callback for read tracing. ++ * ++ * If tracing is enabled then this is called once for each syntax ++ * element parsed. ++ */ ++ CBSTraceReadCallback trace_read_callback; ++ /** ++ * Callback for write tracing. ++ * ++ * If tracing is enabled then this is called once for each syntax ++ * element written. ++ */ ++ CBSTraceWriteCallback trace_write_callback; + + /** + * Write buffer. Used as intermediate buffer when writing units. +@@ -433,4 +496,27 @@ int ff_cbs_make_unit_writable(CodedBitstreamContext *ctx, + CodedBitstreamUnit *unit); + + ++ ++/** ++ * Helper function for read tracing which formats the syntax element ++ * and logs the result. ++ * ++ * Trace context should be set to the CodedBitstreamContext. ++ */ ++void ff_cbs_trace_read_log(void *trace_context, ++ struct GetBitContext *gbc, int length, ++ const char *str, const int *subscripts, ++ int64_t value); ++ ++/** ++ * Helper function for write tracing which formats the syntax element ++ * and logs the result. ++ * ++ * Trace context should be set to the CodedBitstreamContext. ++ */ ++void ff_cbs_trace_write_log(void *trace_context, ++ struct PutBitContext *pbc, int length, ++ const char *str, const int *subscripts, ++ int64_t value); ++ + #endif /* AVCODEC_CBS_H */ +diff --git a/libavcodec/cbs_av1.c b/libavcodec/cbs_av1.c +index 45e1288..6098c97 100644 +--- a/libavcodec/cbs_av1.c ++++ b/libavcodec/cbs_av1.c +@@ -31,10 +31,8 @@ static int cbs_av1_read_uvlc(CodedBitstreamContext *ctx, GetBitContext *gbc, + uint32_t range_min, uint32_t range_max) + { + uint32_t zeroes, bits_value, value; +- int position; + +- if (ctx->trace_enable) +- position = get_bits_count(gbc); ++ CBS_TRACE_READ_START(); + + zeroes = 0; + while (1) { +@@ -50,6 +48,9 @@ static int cbs_av1_read_uvlc(CodedBitstreamContext *ctx, GetBitContext *gbc, + } + + if (zeroes >= 32) { ++ // Note that the spec allows an arbitrarily large number of ++ // zero bits followed by a one bit in this case, but the ++ // libaom implementation does not support it. + value = MAX_UINT_BITS(32); + } else { + if (get_bits_left(gbc) < zeroes) { +@@ -62,36 +63,7 @@ static int cbs_av1_read_uvlc(CodedBitstreamContext *ctx, GetBitContext *gbc, + value = bits_value + (UINT32_C(1) << zeroes) - 1; + } + +- if (ctx->trace_enable) { +- char bits[65]; +- int i, j, k; +- +- if (zeroes >= 32) { +- while (zeroes > 32) { +- k = FFMIN(zeroes - 32, 32); +- for (i = 0; i < k; i++) +- bits[i] = '0'; +- bits[i] = 0; +- ff_cbs_trace_syntax_element(ctx, position, name, +- NULL, bits, 0); +- zeroes -= k; +- position += k; +- } +- } +- +- for (i = 0; i < zeroes; i++) +- bits[i] = '0'; +- bits[i++] = '1'; +- +- if (zeroes < 32) { +- for (j = 0; j < zeroes; j++) +- bits[i++] = (bits_value >> (zeroes - j - 1) & 1) ? '1' : '0'; +- } +- +- bits[i] = 0; +- ff_cbs_trace_syntax_element(ctx, position, name, +- NULL, bits, value); +- } ++ CBS_TRACE_READ_END_NO_SUBSCRIPTS(); + + if (value < range_min || value > range_max) { + av_log(ctx->log_ctx, AV_LOG_ERROR, "%s out of range: " +@@ -109,7 +81,9 @@ static int cbs_av1_write_uvlc(CodedBitstreamContext *ctx, PutBitContext *pbc, + uint32_t range_min, uint32_t range_max) + { + uint32_t v; +- int position, zeroes; ++ int zeroes; ++ ++ CBS_TRACE_WRITE_START(); + + if (value < range_min || value > range_max) { + av_log(ctx->log_ctx, AV_LOG_ERROR, "%s out of range: " +@@ -118,28 +92,17 @@ static int cbs_av1_write_uvlc(CodedBitstreamContext *ctx, PutBitContext *pbc, + return AVERROR_INVALIDDATA; + } + +- if (ctx->trace_enable) +- position = put_bits_count(pbc); +- + zeroes = av_log2(value + 1); + v = value - (1U << zeroes) + 1; ++ ++ if (put_bits_left(pbc) < 2 * zeroes + 1) ++ return AVERROR(ENOSPC); ++ + put_bits(pbc, zeroes, 0); + put_bits(pbc, 1, 1); + put_bits(pbc, zeroes, v); + +- if (ctx->trace_enable) { +- char bits[65]; +- int i, j; +- i = 0; +- for (j = 0; j < zeroes; j++) +- bits[i++] = '0'; +- bits[i++] = '1'; +- for (j = 0; j < zeroes; j++) +- bits[i++] = (v >> (zeroes - j - 1) & 1) ? '1' : '0'; +- bits[i++] = 0; +- ff_cbs_trace_syntax_element(ctx, position, name, NULL, +- bits, value); +- } ++ CBS_TRACE_WRITE_END_NO_SUBSCRIPTS(); + + return 0; + } +@@ -148,20 +111,19 @@ static int cbs_av1_read_leb128(CodedBitstreamContext *ctx, GetBitContext *gbc, + const char *name, uint64_t *write_to) + { + uint64_t value; +- int position, err, i; ++ uint32_t byte; ++ int i; + +- if (ctx->trace_enable) +- position = get_bits_count(gbc); ++ CBS_TRACE_READ_START(); + + value = 0; + for (i = 0; i < 8; i++) { +- int subscript[2] = { 1, i }; +- uint32_t byte; +- err = ff_cbs_read_unsigned(ctx, gbc, 8, "leb128_byte[i]", subscript, +- &byte, 0x00, 0xff); +- if (err < 0) +- return err; +- ++ if (get_bits_left(gbc) < 8) { ++ av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid leb128 at " ++ "%s: bitstream ended.\n", name); ++ return AVERROR_INVALIDDATA; ++ } ++ byte = get_bits(gbc, 8); + value |= (uint64_t)(byte & 0x7f) << (i * 7); + if (!(byte & 0x80)) + break; +@@ -170,39 +132,38 @@ static int cbs_av1_read_leb128(CodedBitstreamContext *ctx, GetBitContext *gbc, + if (value > UINT32_MAX) + return AVERROR_INVALIDDATA; + +- if (ctx->trace_enable) +- ff_cbs_trace_syntax_element(ctx, position, name, NULL, "", value); ++ CBS_TRACE_READ_END_NO_SUBSCRIPTS(); + + *write_to = value; + return 0; + } + ++/** Minimum byte length will be used to indicate the len128 of value if byte_len is 0. */ + static int cbs_av1_write_leb128(CodedBitstreamContext *ctx, PutBitContext *pbc, +- const char *name, uint64_t value) ++ const char *name, uint64_t value, uint8_t byte_len) + { +- int position, err, len, i; ++ int len, i; + uint8_t byte; + +- len = (av_log2(value) + 7) / 7; ++ CBS_TRACE_WRITE_START(); ++ ++ if (byte_len) ++ av_assert0(byte_len >= (av_log2(value) + 7) / 7); + +- if (ctx->trace_enable) +- position = put_bits_count(pbc); ++ len = byte_len ? byte_len : (av_log2(value) + 7) / 7; + + for (i = 0; i < len; i++) { +- int subscript[2] = { 1, i }; ++ if (put_bits_left(pbc) < 8) ++ return AVERROR(ENOSPC); + + byte = value >> (7 * i) & 0x7f; + if (i < len - 1) + byte |= 0x80; + +- err = ff_cbs_write_unsigned(ctx, pbc, 8, "leb128_byte[i]", subscript, +- byte, 0x00, 0xff); +- if (err < 0) +- return err; ++ put_bits(pbc, 8, byte); + } + +- if (ctx->trace_enable) +- ff_cbs_trace_syntax_element(ctx, position, name, NULL, "", value); ++ CBS_TRACE_WRITE_END_NO_SUBSCRIPTS(); + + return 0; + } +@@ -212,12 +173,11 @@ static int cbs_av1_read_ns(CodedBitstreamContext *ctx, GetBitContext *gbc, + const int *subscripts, uint32_t *write_to) + { + uint32_t m, v, extra_bit, value; +- int position, w; ++ int w; + +- av_assert0(n > 0); ++ CBS_TRACE_READ_START(); + +- if (ctx->trace_enable) +- position = get_bits_count(gbc); ++ av_assert0(n > 0); + + w = av_log2(n) + 1; + m = (1 << w) - n; +@@ -240,18 +200,7 @@ static int cbs_av1_read_ns(CodedBitstreamContext *ctx, GetBitContext *gbc, + value = (v << 1) - m + extra_bit; + } + +- if (ctx->trace_enable) { +- char bits[33]; +- int i; +- for (i = 0; i < w - 1; i++) +- bits[i] = (v >> i & 1) ? '1' : '0'; +- if (v >= m) +- bits[i++] = extra_bit ? '1' : '0'; +- bits[i] = 0; +- +- ff_cbs_trace_syntax_element(ctx, position, +- name, subscripts, bits, value); +- } ++ CBS_TRACE_READ_END(); + + *write_to = value; + return 0; +@@ -262,7 +211,8 @@ static int cbs_av1_write_ns(CodedBitstreamContext *ctx, PutBitContext *pbc, + const int *subscripts, uint32_t value) + { + uint32_t w, m, v, extra_bit; +- int position; ++ ++ CBS_TRACE_WRITE_START(); + + if (value > n) { + av_log(ctx->log_ctx, AV_LOG_ERROR, "%s out of range: " +@@ -271,9 +221,6 @@ static int cbs_av1_write_ns(CodedBitstreamContext *ctx, PutBitContext *pbc, + return AVERROR_INVALIDDATA; + } + +- if (ctx->trace_enable) +- position = put_bits_count(pbc); +- + w = av_log2(n) + 1; + m = (1 << w) - n; + +@@ -290,18 +237,7 @@ static int cbs_av1_write_ns(CodedBitstreamContext *ctx, PutBitContext *pbc, + put_bits(pbc, 1, extra_bit); + } + +- if (ctx->trace_enable) { +- char bits[33]; +- int i; +- for (i = 0; i < w - 1; i++) +- bits[i] = (v >> i & 1) ? '1' : '0'; +- if (value >= m) +- bits[i++] = extra_bit ? '1' : '0'; +- bits[i] = 0; +- +- ff_cbs_trace_syntax_element(ctx, position, +- name, subscripts, bits, value); +- } ++ CBS_TRACE_WRITE_END(); + + return 0; + } +@@ -311,33 +247,24 @@ static int cbs_av1_read_increment(CodedBitstreamContext *ctx, GetBitContext *gbc + const char *name, uint32_t *write_to) + { + uint32_t value; +- int position, i; +- char bits[33]; + +- av_assert0(range_min <= range_max && range_max - range_min < sizeof(bits) - 1); +- if (ctx->trace_enable) +- position = get_bits_count(gbc); ++ CBS_TRACE_READ_START(); ++ ++ av_assert0(range_min <= range_max && range_max - range_min < 32); + +- for (i = 0, value = range_min; value < range_max;) { ++ for (value = range_min; value < range_max;) { + if (get_bits_left(gbc) < 1) { + av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid increment value at " + "%s: bitstream ended.\n", name); + return AVERROR_INVALIDDATA; + } +- if (get_bits1(gbc)) { +- bits[i++] = '1'; ++ if (get_bits1(gbc)) + ++value; +- } else { +- bits[i++] = '0'; ++ else + break; +- } + } + +- if (ctx->trace_enable) { +- bits[i] = 0; +- ff_cbs_trace_syntax_element(ctx, position, +- name, NULL, bits, value); +- } ++ CBS_TRACE_READ_END_NO_SUBSCRIPTS(); + + *write_to = value; + return 0; +@@ -349,6 +276,8 @@ static int cbs_av1_write_increment(CodedBitstreamContext *ctx, PutBitContext *pb + { + int len; + ++ CBS_TRACE_WRITE_START(); ++ + av_assert0(range_min <= range_max && range_max - range_min < 32); + if (value < range_min || value > range_max) { + av_log(ctx->log_ctx, AV_LOG_ERROR, "%s out of range: " +@@ -364,23 +293,11 @@ static int cbs_av1_write_increment(CodedBitstreamContext *ctx, PutBitContext *pb + if (put_bits_left(pbc) < len) + return AVERROR(ENOSPC); + +- if (ctx->trace_enable) { +- char bits[33]; +- int i; +- for (i = 0; i < len; i++) { +- if (range_min + i == value) +- bits[i] = '0'; +- else +- bits[i] = '1'; +- } +- bits[i] = 0; +- ff_cbs_trace_syntax_element(ctx, put_bits_count(pbc), +- name, NULL, bits, value); +- } +- + if (len > 0) + put_bits(pbc, len, (1 << len) - 1 - (value != range_max)); + ++ CBS_TRACE_WRITE_END_NO_SUBSCRIPTS(); ++ + return 0; + } + +@@ -388,12 +305,10 @@ static int cbs_av1_read_subexp(CodedBitstreamContext *ctx, GetBitContext *gbc, + uint32_t range_max, const char *name, + const int *subscripts, uint32_t *write_to) + { +- uint32_t value; +- int position, err; +- uint32_t max_len, len, range_offset, range_bits; ++ uint32_t value, max_len, len, range_offset, range_bits; ++ int err; + +- if (ctx->trace_enable) +- position = get_bits_count(gbc); ++ CBS_TRACE_READ_START(); + + av_assert0(range_max > 0); + max_len = av_log2(range_max - 1) - 3; +@@ -412,9 +327,8 @@ static int cbs_av1_read_subexp(CodedBitstreamContext *ctx, GetBitContext *gbc, + } + + if (len < max_len) { +- err = ff_cbs_read_unsigned(ctx, gbc, range_bits, +- "subexp_bits", NULL, &value, +- 0, MAX_UINT_BITS(range_bits)); ++ err = ff_cbs_read_simple_unsigned(ctx, gbc, range_bits, ++ "subexp_bits", &value); + if (err < 0) + return err; + +@@ -426,9 +340,7 @@ static int cbs_av1_read_subexp(CodedBitstreamContext *ctx, GetBitContext *gbc, + } + value += range_offset; + +- if (ctx->trace_enable) +- ff_cbs_trace_syntax_element(ctx, position, +- name, subscripts, "", value); ++ CBS_TRACE_READ_END_VALUE_ONLY(); + + *write_to = value; + return err; +@@ -438,9 +350,11 @@ static int cbs_av1_write_subexp(CodedBitstreamContext *ctx, PutBitContext *pbc, + uint32_t range_max, const char *name, + const int *subscripts, uint32_t value) + { +- int position, err; ++ int err; + uint32_t max_len, len, range_offset, range_bits; + ++ CBS_TRACE_WRITE_START(); ++ + if (value > range_max) { + av_log(ctx->log_ctx, AV_LOG_ERROR, "%s out of range: " + "%"PRIu32", but must be in [0,%"PRIu32"].\n", +@@ -448,9 +362,6 @@ static int cbs_av1_write_subexp(CodedBitstreamContext *ctx, PutBitContext *pbc, + return AVERROR_INVALIDDATA; + } + +- if (ctx->trace_enable) +- position = put_bits_count(pbc); +- + av_assert0(range_max > 0); + max_len = av_log2(range_max - 1) - 3; + +@@ -476,10 +387,9 @@ static int cbs_av1_write_subexp(CodedBitstreamContext *ctx, PutBitContext *pbc, + return err; + + if (len < max_len) { +- err = ff_cbs_write_unsigned(ctx, pbc, range_bits, +- "subexp_bits", NULL, +- value - range_offset, +- 0, MAX_UINT_BITS(range_bits)); ++ err = ff_cbs_write_simple_unsigned(ctx, pbc, range_bits, ++ "subexp_bits", ++ value - range_offset); + if (err < 0) + return err; + +@@ -491,9 +401,7 @@ static int cbs_av1_write_subexp(CodedBitstreamContext *ctx, PutBitContext *pbc, + return err; + } + +- if (ctx->trace_enable) +- ff_cbs_trace_syntax_element(ctx, position, +- name, subscripts, "", value); ++ CBS_TRACE_WRITE_END_VALUE_ONLY(); + + return err; + } +@@ -546,8 +454,6 @@ static size_t cbs_av1_get_payload_bytes_left(GetBitContext *gbc) + + #define SUBSCRIPTS(subs, ...) (subs > 0 ? ((int[subs + 1]){ subs, __VA_ARGS__ }) : NULL) + +-#define fb(width, name) \ +- xf(width, name, current->name, 0, MAX_UINT_BITS(width), 0, ) + #define fc(width, name, range_min, range_max) \ + xf(width, name, current->name, range_min, range_max, 0, ) + #define flag(name) fb(1, name) +@@ -573,6 +479,13 @@ static size_t cbs_av1_get_payload_bytes_left(GetBitContext *gbc) + #define READWRITE read + #define RWContext GetBitContext + ++#define fb(width, name) do { \ ++ uint32_t value; \ ++ CHECK(ff_cbs_read_simple_unsigned(ctx, rw, width, \ ++ #name, &value)); \ ++ current->name = value; \ ++ } while (0) ++ + #define xf(width, name, var, range_min, range_max, subs, ...) do { \ + uint32_t value; \ + CHECK(ff_cbs_read_unsigned(ctx, rw, width, #name, \ +@@ -645,6 +558,7 @@ static size_t cbs_av1_get_payload_bytes_left(GetBitContext *gbc) + #undef READ + #undef READWRITE + #undef RWContext ++#undef fb + #undef xf + #undef xsu + #undef uvlc +@@ -661,6 +575,11 @@ static size_t cbs_av1_get_payload_bytes_left(GetBitContext *gbc) + #define READWRITE write + #define RWContext PutBitContext + ++#define fb(width, name) do { \ ++ CHECK(ff_cbs_write_simple_unsigned(ctx, rw, width, #name, \ ++ current->name)); \ ++ } while (0) ++ + #define xf(width, name, var, range_min, range_max, subs, ...) do { \ + CHECK(ff_cbs_write_unsigned(ctx, rw, width, #name, \ + SUBSCRIPTS(subs, __VA_ARGS__), \ +@@ -703,7 +622,7 @@ static size_t cbs_av1_get_payload_bytes_left(GetBitContext *gbc) + } while (0) + + #define leb128(name) do { \ +- CHECK(cbs_av1_write_leb128(ctx, rw, #name, current->name)); \ ++ CHECK(cbs_av1_write_leb128(ctx, rw, #name, current->name, 0)); \ + } while (0) + + #define infer(name, value) do { \ +@@ -723,6 +642,7 @@ static size_t cbs_av1_get_payload_bytes_left(GetBitContext *gbc) + #undef WRITE + #undef READWRITE + #undef RWContext ++#undef fb + #undef xf + #undef xsu + #undef uvlc +@@ -1086,9 +1006,14 @@ static int cbs_av1_write_obu(CodedBitstreamContext *ctx, + + if (obu->header.obu_has_size_field) { + pbc_tmp = *pbc; +- // Add space for the size field to fill later. +- put_bits32(pbc, 0); +- put_bits32(pbc, 0); ++ if (obu->obu_size_byte_len) { ++ for (int i = 0; i < obu->obu_size_byte_len; i++) ++ put_bits(pbc, 8, 0); ++ } else { ++ // Add space for the size field to fill later. ++ put_bits32(pbc, 0); ++ put_bits32(pbc, 0); ++ } + } + + td = NULL; +@@ -1208,7 +1133,7 @@ static int cbs_av1_write_obu(CodedBitstreamContext *ctx, + end_pos /= 8; + + *pbc = pbc_tmp; +- err = cbs_av1_write_leb128(ctx, pbc, "obu_size", obu->obu_size); ++ err = cbs_av1_write_leb128(ctx, pbc, "obu_size", obu->obu_size, obu->obu_size_byte_len); + if (err < 0) + goto error; + +@@ -1225,8 +1150,11 @@ static int cbs_av1_write_obu(CodedBitstreamContext *ctx, + } + + if (obu->obu_size > 0) { +- memmove(pbc->buf + data_pos, +- pbc->buf + start_pos, header_size); ++ if (!obu->obu_size_byte_len) { ++ obu->obu_size_byte_len = start_pos - data_pos; ++ memmove(pbc->buf + data_pos, ++ pbc->buf + start_pos, header_size); ++ } + skip_put_bytes(pbc, header_size); + + if (td) { +diff --git a/libavcodec/cbs_av1.h b/libavcodec/cbs_av1.h +index 1fc80dc..c5dae3c 100644 +--- a/libavcodec/cbs_av1.h ++++ b/libavcodec/cbs_av1.h +@@ -392,6 +392,7 @@ typedef struct AV1RawOBU { + AV1RawOBUHeader header; + + size_t obu_size; ++ uint8_t obu_size_byte_len; + + union { + AV1RawSequenceHeader sequence_header; +diff --git a/libavcodec/cbs_av1_syntax_template.c b/libavcodec/cbs_av1_syntax_template.c +index e95925a..cf2e259 100644 +--- a/libavcodec/cbs_av1_syntax_template.c ++++ b/libavcodec/cbs_av1_syntax_template.c +@@ -1018,9 +1018,9 @@ static int FUNC(read_tx_mode)(CodedBitstreamContext *ctx, RWContext *rw, + int err; + + if (priv->coded_lossless) +- infer(tx_mode, 0); ++ infer(tx_mode, AV1_ONLY_4X4); + else +- increment(tx_mode, 1, 2); ++ increment(tx_mode, AV1_TX_MODE_LARGEST, AV1_TX_MODE_SELECT); + + return 0; + } +diff --git a/libavcodec/cbs_bsf.c b/libavcodec/cbs_bsf.c +index 069f6e9..b252854 100644 +--- a/libavcodec/cbs_bsf.c ++++ b/libavcodec/cbs_bsf.c +@@ -123,6 +123,11 @@ int ff_cbs_bsf_generic_init(AVBSFContext *bsf, const CBSBSFType *type) + if (err < 0) + return err; + ++ ctx->output->trace_enable = 1; ++ ctx->output->trace_level = AV_LOG_TRACE; ++ ctx->output->trace_context = ctx->output; ++ ctx->output->trace_write_callback = ff_cbs_trace_write_log; ++ + if (bsf->par_in->extradata) { + err = ff_cbs_read_extradata(ctx->input, frag, bsf->par_in); + if (err < 0) { +diff --git a/libavcodec/cbs_h2645.c b/libavcodec/cbs_h2645.c +index 80e4882..355f4d5 100644 +--- a/libavcodec/cbs_h2645.c ++++ b/libavcodec/cbs_h2645.c +@@ -34,41 +34,38 @@ static int cbs_read_ue_golomb(CodedBitstreamContext *ctx, GetBitContext *gbc, + uint32_t *write_to, + uint32_t range_min, uint32_t range_max) + { +- uint32_t value; +- int position, i, j; +- unsigned int k; +- char bits[65]; ++ uint32_t leading_bits, value; ++ int max_length, leading_zeroes; + +- position = get_bits_count(gbc); ++ CBS_TRACE_READ_START(); + +- for (i = 0; i < 32; i++) { +- if (get_bits_left(gbc) < i + 1) { ++ max_length = FFMIN(get_bits_left(gbc), 32); ++ ++ leading_bits = show_bits_long(gbc, max_length); ++ if (leading_bits == 0) { ++ if (max_length >= 32) { ++ av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid ue-golomb code at " ++ "%s: more than 31 zeroes.\n", name); ++ return AVERROR_INVALIDDATA; ++ } else { + av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid ue-golomb code at " + "%s: bitstream ended.\n", name); + return AVERROR_INVALIDDATA; + } +- k = get_bits1(gbc); +- bits[i] = k ? '1' : '0'; +- if (k) +- break; + } +- if (i >= 32) { ++ ++ leading_zeroes = max_length - 1 - av_log2(leading_bits); ++ skip_bits_long(gbc, leading_zeroes); ++ ++ if (get_bits_left(gbc) < leading_zeroes + 1) { + av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid ue-golomb code at " +- "%s: more than 31 zeroes.\n", name); ++ "%s: bitstream ended.\n", name); + return AVERROR_INVALIDDATA; + } +- value = 1; +- for (j = 0; j < i; j++) { +- k = get_bits1(gbc); +- bits[i + j + 1] = k ? '1' : '0'; +- value = value << 1 | k; +- } +- bits[i + j + 1] = 0; +- --value; + +- if (ctx->trace_enable) +- ff_cbs_trace_syntax_element(ctx, position, name, subscripts, +- bits, value); ++ value = get_bits_long(gbc, leading_zeroes + 1) - 1; ++ ++ CBS_TRACE_READ_END(); + + if (value < range_min || value > range_max) { + av_log(ctx->log_ctx, AV_LOG_ERROR, "%s out of range: " +@@ -86,45 +83,44 @@ static int cbs_read_se_golomb(CodedBitstreamContext *ctx, GetBitContext *gbc, + int32_t *write_to, + int32_t range_min, int32_t range_max) + { ++ uint32_t leading_bits, unsigned_value; ++ int max_length, leading_zeroes; + int32_t value; +- int position, i, j; +- unsigned int k; +- uint32_t v; +- char bits[65]; + +- position = get_bits_count(gbc); ++ CBS_TRACE_READ_START(); + +- for (i = 0; i < 32; i++) { +- if (get_bits_left(gbc) < i + 1) { ++ max_length = FFMIN(get_bits_left(gbc), 32); ++ ++ leading_bits = show_bits_long(gbc, max_length); ++ if (leading_bits == 0) { ++ if (max_length >= 32) { ++ av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid se-golomb code at " ++ "%s: more than 31 zeroes.\n", name); ++ return AVERROR_INVALIDDATA; ++ } else { + av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid se-golomb code at " + "%s: bitstream ended.\n", name); + return AVERROR_INVALIDDATA; + } +- k = get_bits1(gbc); +- bits[i] = k ? '1' : '0'; +- if (k) +- break; + } +- if (i >= 32) { ++ ++ leading_zeroes = max_length - 1 - av_log2(leading_bits); ++ skip_bits_long(gbc, leading_zeroes); ++ ++ if (get_bits_left(gbc) < leading_zeroes + 1) { + av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid se-golomb code at " +- "%s: more than 31 zeroes.\n", name); ++ "%s: bitstream ended.\n", name); + return AVERROR_INVALIDDATA; + } +- v = 1; +- for (j = 0; j < i; j++) { +- k = get_bits1(gbc); +- bits[i + j + 1] = k ? '1' : '0'; +- v = v << 1 | k; +- } +- bits[i + j + 1] = 0; +- if (v & 1) +- value = -(int32_t)(v / 2); ++ ++ unsigned_value = get_bits_long(gbc, leading_zeroes + 1); ++ ++ if (unsigned_value & 1) ++ value = -(int32_t)(unsigned_value / 2); + else +- value = v / 2; ++ value = unsigned_value / 2; + +- if (ctx->trace_enable) +- ff_cbs_trace_syntax_element(ctx, position, name, subscripts, +- bits, value); ++ CBS_TRACE_READ_END(); + + if (value < range_min || value > range_max) { + av_log(ctx->log_ctx, AV_LOG_ERROR, "%s out of range: " +@@ -144,6 +140,8 @@ static int cbs_write_ue_golomb(CodedBitstreamContext *ctx, PutBitContext *pbc, + { + int len; + ++ CBS_TRACE_WRITE_START(); ++ + if (value < range_min || value > range_max) { + av_log(ctx->log_ctx, AV_LOG_ERROR, "%s out of range: " + "%"PRIu32", but must be in [%"PRIu32",%"PRIu32"].\n", +@@ -156,27 +154,14 @@ static int cbs_write_ue_golomb(CodedBitstreamContext *ctx, PutBitContext *pbc, + if (put_bits_left(pbc) < 2 * len + 1) + return AVERROR(ENOSPC); + +- if (ctx->trace_enable) { +- char bits[65]; +- int i; +- +- for (i = 0; i < len; i++) +- bits[i] = '0'; +- bits[len] = '1'; +- for (i = 0; i < len; i++) +- bits[len + i + 1] = (value + 1) >> (len - i - 1) & 1 ? '1' : '0'; +- bits[len + len + 1] = 0; +- +- ff_cbs_trace_syntax_element(ctx, put_bits_count(pbc), +- name, subscripts, bits, value); +- } +- + put_bits(pbc, len, 0); + if (len + 1 < 32) + put_bits(pbc, len + 1, value + 1); + else + put_bits32(pbc, value + 1); + ++ CBS_TRACE_WRITE_END(); ++ + return 0; + } + +@@ -188,6 +173,8 @@ static int cbs_write_se_golomb(CodedBitstreamContext *ctx, PutBitContext *pbc, + int len; + uint32_t uvalue; + ++ CBS_TRACE_WRITE_START(); ++ + if (value < range_min || value > range_max) { + av_log(ctx->log_ctx, AV_LOG_ERROR, "%s out of range: " + "%"PRId32", but must be in [%"PRId32",%"PRId32"].\n", +@@ -207,27 +194,14 @@ static int cbs_write_se_golomb(CodedBitstreamContext *ctx, PutBitContext *pbc, + if (put_bits_left(pbc) < 2 * len + 1) + return AVERROR(ENOSPC); + +- if (ctx->trace_enable) { +- char bits[65]; +- int i; +- +- for (i = 0; i < len; i++) +- bits[i] = '0'; +- bits[len] = '1'; +- for (i = 0; i < len; i++) +- bits[len + i + 1] = (uvalue + 1) >> (len - i - 1) & 1 ? '1' : '0'; +- bits[len + len + 1] = 0; +- +- ff_cbs_trace_syntax_element(ctx, put_bits_count(pbc), +- name, subscripts, bits, value); +- } +- + put_bits(pbc, len, 0); + if (len + 1 < 32) + put_bits(pbc, len + 1, uvalue + 1); + else + put_bits32(pbc, uvalue + 1); + ++ CBS_TRACE_WRITE_END(); ++ + return 0; + } + +@@ -261,8 +235,6 @@ static int cbs_h265_payload_extension_present(GetBitContext *gbc, uint32_t paylo + + #define u(width, name, range_min, range_max) \ + xu(width, name, current->name, range_min, range_max, 0, ) +-#define ub(width, name) \ +- xu(width, name, current->name, 0, MAX_UINT_BITS(width), 0, ) + #define flag(name) ub(1, name) + #define ue(name, range_min, range_max) \ + xue(name, current->name, range_min, range_max, 0, ) +@@ -298,6 +270,12 @@ static int cbs_h265_payload_extension_present(GetBitContext *gbc, uint32_t paylo + #define READWRITE read + #define RWContext GetBitContext + ++#define ub(width, name) do { \ ++ uint32_t value; \ ++ CHECK(ff_cbs_read_simple_unsigned(ctx, rw, width, #name, \ ++ &value)); \ ++ current->name = value; \ ++ } while (0) + #define xu(width, name, var, range_min, range_max, subs, ...) do { \ + uint32_t value; \ + CHECK(ff_cbs_read_unsigned(ctx, rw, width, #name, \ +@@ -372,6 +350,7 @@ static int cbs_h2645_read_more_rbsp_data(GetBitContext *gbc) + #undef READ + #undef READWRITE + #undef RWContext ++#undef ub + #undef xu + #undef xi + #undef xue +@@ -387,6 +366,11 @@ static int cbs_h2645_read_more_rbsp_data(GetBitContext *gbc) + #define READWRITE write + #define RWContext PutBitContext + ++#define ub(width, name) do { \ ++ uint32_t value = current->name; \ ++ CHECK(ff_cbs_write_simple_unsigned(ctx, rw, width, #name, \ ++ value)); \ ++ } while (0) + #define xu(width, name, var, range_min, range_max, subs, ...) do { \ + uint32_t value = var; \ + CHECK(ff_cbs_write_unsigned(ctx, rw, width, #name, \ +@@ -450,6 +434,7 @@ static int cbs_h2645_read_more_rbsp_data(GetBitContext *gbc) + #undef WRITE + #undef READWRITE + #undef RWContext ++#undef ub + #undef xu + #undef xi + #undef xue +diff --git a/libavcodec/cbs_internal.h b/libavcodec/cbs_internal.h +index e585c77..60e31eb 100644 +--- a/libavcodec/cbs_internal.h ++++ b/libavcodec/cbs_internal.h +@@ -151,24 +151,29 @@ typedef struct CodedBitstreamType { + void ff_cbs_trace_header(CodedBitstreamContext *ctx, + const char *name); + +-void ff_cbs_trace_syntax_element(CodedBitstreamContext *ctx, int position, +- const char *name, const int *subscripts, +- const char *bitstring, int64_t value); +- + + // Helper functions for read/write of common bitstream elements, including +-// generation of trace output. ++// generation of trace output. The simple functions are equivalent to ++// their non-simple counterparts except that their range is unrestricted ++// (i.e. only limited by the amount of bits used) and they lack ++// the ability to use subscripts. + + int ff_cbs_read_unsigned(CodedBitstreamContext *ctx, GetBitContext *gbc, + int width, const char *name, + const int *subscripts, uint32_t *write_to, + uint32_t range_min, uint32_t range_max); + ++int ff_cbs_read_simple_unsigned(CodedBitstreamContext *ctx, GetBitContext *gbc, ++ int width, const char *name, uint32_t *write_to); ++ + int ff_cbs_write_unsigned(CodedBitstreamContext *ctx, PutBitContext *pbc, + int width, const char *name, + const int *subscripts, uint32_t value, + uint32_t range_min, uint32_t range_max); + ++int ff_cbs_write_simple_unsigned(CodedBitstreamContext *ctx, PutBitContext *pbc, ++ int width, const char *name, uint32_t value); ++ + int ff_cbs_read_signed(CodedBitstreamContext *ctx, GetBitContext *gbc, + int width, const char *name, + const int *subscripts, int32_t *write_to, +@@ -191,6 +196,87 @@ int ff_cbs_write_signed(CodedBitstreamContext *ctx, PutBitContext *pbc, + // range_min in the above functions. + #define MIN_INT_BITS(length) (-(INT64_C(1) << ((length) - 1))) + ++ ++// Start of a syntax element during read tracing. ++#define CBS_TRACE_READ_START() \ ++ GetBitContext trace_start; \ ++ do { \ ++ if (ctx->trace_enable) \ ++ trace_start = *gbc; \ ++ } while (0) ++ ++// End of a syntax element for tracing, make callback. ++#define CBS_TRACE_READ_END() \ ++ do { \ ++ if (ctx->trace_enable) { \ ++ int start_position = get_bits_count(&trace_start); \ ++ int end_position = get_bits_count(gbc); \ ++ av_assert0(start_position <= end_position); \ ++ ctx->trace_read_callback(ctx->trace_context, &trace_start, \ ++ end_position - start_position, \ ++ name, subscripts, value); \ ++ } \ ++ } while (0) ++ ++// End of a syntax element with no subscript entries. ++#define CBS_TRACE_READ_END_NO_SUBSCRIPTS() \ ++ do { \ ++ const int *subscripts = NULL; \ ++ CBS_TRACE_READ_END(); \ ++ } while (0) ++ ++// End of a syntax element which is made up of subelements which ++// are aleady traced, so we are only showing the value. ++#define CBS_TRACE_READ_END_VALUE_ONLY() \ ++ do { \ ++ if (ctx->trace_enable) { \ ++ ctx->trace_read_callback(ctx->trace_context, &trace_start, 0, \ ++ name, subscripts, value); \ ++ } \ ++ } while (0) ++ ++// Start of a syntax element during write tracing. ++#define CBS_TRACE_WRITE_START() \ ++ int start_position; \ ++ do { \ ++ if (ctx->trace_enable) \ ++ start_position = put_bits_count(pbc);; \ ++ } while (0) ++ ++// End of a syntax element for tracing, make callback. ++#define CBS_TRACE_WRITE_END() \ ++ do { \ ++ if (ctx->trace_enable) { \ ++ int end_position = put_bits_count(pbc); \ ++ av_assert0(start_position <= end_position); \ ++ ctx->trace_write_callback(ctx->trace_context, pbc, \ ++ end_position - start_position, \ ++ name, subscripts, value); \ ++ } \ ++ } while (0) ++ ++// End of a syntax element with no subscript entries. ++#define CBS_TRACE_WRITE_END_NO_SUBSCRIPTS() \ ++ do { \ ++ const int *subscripts = NULL; \ ++ CBS_TRACE_WRITE_END(); \ ++ } while (0) ++ ++// End of a syntax element which is made up of subelements which are ++// aleady traced, so we are only showing the value. This forges a ++// PutBitContext to point to the position of the start of the syntax ++// element, but the other state doesn't matter because length is zero. ++#define CBS_TRACE_WRITE_END_VALUE_ONLY() \ ++ do { \ ++ if (ctx->trace_enable) { \ ++ PutBitContext tmp; \ ++ init_put_bits(&tmp, pbc->buf, start_position); \ ++ skip_put_bits(&tmp, start_position); \ ++ ctx->trace_write_callback(ctx->trace_context, &tmp, 0, \ ++ name, subscripts, value); \ ++ } \ ++ } while (0) ++ + #define TYPE_LIST(...) { __VA_ARGS__ } + #define CBS_UNIT_TYPE_POD(type_, structure) { \ + .nb_unit_types = 1, \ +diff --git a/libavcodec/cbs_mpeg2.c b/libavcodec/cbs_mpeg2.c +index 04b0c7f..37fc28a 100644 +--- a/libavcodec/cbs_mpeg2.c ++++ b/libavcodec/cbs_mpeg2.c +@@ -40,8 +40,6 @@ + + #define SUBSCRIPTS(subs, ...) (subs > 0 ? ((int[subs + 1]){ subs, __VA_ARGS__ }) : NULL) + +-#define ui(width, name) \ +- xui(width, name, current->name, 0, MAX_UINT_BITS(width), 0, ) + #define uir(width, name) \ + xui(width, name, current->name, 1, MAX_UINT_BITS(width), 0, ) + #define uis(width, name, subs, ...) \ +@@ -65,6 +63,12 @@ + #define READWRITE read + #define RWContext GetBitContext + ++#define ui(width, name) do { \ ++ uint32_t value; \ ++ CHECK(ff_cbs_read_simple_unsigned(ctx, rw, width, #name, \ ++ &value)); \ ++ current->name = value; \ ++ } while (0) + #define xuia(width, string, var, range_min, range_max, subs, ...) do { \ + uint32_t value; \ + CHECK(ff_cbs_read_unsigned(ctx, rw, width, string, \ +@@ -95,6 +99,7 @@ + #undef READ + #undef READWRITE + #undef RWContext ++#undef ui + #undef xuia + #undef xsi + #undef nextbits +@@ -105,6 +110,11 @@ + #define READWRITE write + #define RWContext PutBitContext + ++#define ui(width, name) do { \ ++ CHECK(ff_cbs_write_simple_unsigned(ctx, rw, width, #name, \ ++ current->name)); \ ++ } while (0) ++ + #define xuia(width, string, var, range_min, range_max, subs, ...) do { \ + CHECK(ff_cbs_write_unsigned(ctx, rw, width, string, \ + SUBSCRIPTS(subs, __VA_ARGS__), \ +@@ -134,6 +144,7 @@ + #undef WRITE + #undef READWRITE + #undef RWContext ++#undef ui + #undef xuia + #undef xsi + #undef nextbits +diff --git a/libavcodec/cbs_vp9.c b/libavcodec/cbs_vp9.c +index 184fdca..816d06d 100644 +--- a/libavcodec/cbs_vp9.c ++++ b/libavcodec/cbs_vp9.c +@@ -28,11 +28,10 @@ static int cbs_vp9_read_s(CodedBitstreamContext *ctx, GetBitContext *gbc, + const int *subscripts, int32_t *write_to) + { + uint32_t magnitude; +- int position, sign; ++ int sign; + int32_t value; + +- if (ctx->trace_enable) +- position = get_bits_count(gbc); ++ CBS_TRACE_READ_START(); + + if (get_bits_left(gbc) < width + 1) { + av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid signed value at " +@@ -44,17 +43,7 @@ static int cbs_vp9_read_s(CodedBitstreamContext *ctx, GetBitContext *gbc, + sign = get_bits1(gbc); + value = sign ? -(int32_t)magnitude : magnitude; + +- if (ctx->trace_enable) { +- char bits[33]; +- int i; +- for (i = 0; i < width; i++) +- bits[i] = magnitude >> (width - i - 1) & 1 ? '1' : '0'; +- bits[i] = sign ? '1' : '0'; +- bits[i + 1] = 0; +- +- ff_cbs_trace_syntax_element(ctx, position, name, subscripts, +- bits, value); +- } ++ CBS_TRACE_READ_END(); + + *write_to = value; + return 0; +@@ -67,27 +56,19 @@ static int cbs_vp9_write_s(CodedBitstreamContext *ctx, PutBitContext *pbc, + uint32_t magnitude; + int sign; + ++ CBS_TRACE_WRITE_START(); ++ + if (put_bits_left(pbc) < width + 1) + return AVERROR(ENOSPC); + + sign = value < 0; + magnitude = sign ? -value : value; + +- if (ctx->trace_enable) { +- char bits[33]; +- int i; +- for (i = 0; i < width; i++) +- bits[i] = magnitude >> (width - i - 1) & 1 ? '1' : '0'; +- bits[i] = sign ? '1' : '0'; +- bits[i + 1] = 0; +- +- ff_cbs_trace_syntax_element(ctx, put_bits_count(pbc), +- name, subscripts, bits, value); +- } +- + put_bits(pbc, width, magnitude); + put_bits(pbc, 1, sign); + ++ CBS_TRACE_WRITE_END(); ++ + return 0; + } + +@@ -96,32 +77,24 @@ static int cbs_vp9_read_increment(CodedBitstreamContext *ctx, GetBitContext *gbc + const char *name, uint32_t *write_to) + { + uint32_t value; +- int position, i; +- char bits[8]; + +- av_assert0(range_min <= range_max && range_max - range_min < sizeof(bits) - 1); +- if (ctx->trace_enable) +- position = get_bits_count(gbc); ++ CBS_TRACE_READ_START(); ++ ++ av_assert0(range_min <= range_max && range_max - range_min < 32); + +- for (i = 0, value = range_min; value < range_max;) { ++ for (value = range_min; value < range_max;) { + if (get_bits_left(gbc) < 1) { + av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid increment value at " + "%s: bitstream ended.\n", name); + return AVERROR_INVALIDDATA; + } +- if (get_bits1(gbc)) { +- bits[i++] = '1'; ++ if (get_bits1(gbc)) + ++value; +- } else { +- bits[i++] = '0'; ++ else + break; +- } + } + +- if (ctx->trace_enable) { +- bits[i] = 0; +- ff_cbs_trace_syntax_element(ctx, position, name, NULL, bits, value); +- } ++ CBS_TRACE_READ_END_NO_SUBSCRIPTS(); + + *write_to = value; + return 0; +@@ -133,6 +106,8 @@ static int cbs_vp9_write_increment(CodedBitstreamContext *ctx, PutBitContext *pb + { + int len; + ++ CBS_TRACE_WRITE_START(); ++ + av_assert0(range_min <= range_max && range_max - range_min < 8); + if (value < range_min || value > range_max) { + av_log(ctx->log_ctx, AV_LOG_ERROR, "%s out of range: " +@@ -148,23 +123,11 @@ static int cbs_vp9_write_increment(CodedBitstreamContext *ctx, PutBitContext *pb + if (put_bits_left(pbc) < len) + return AVERROR(ENOSPC); + +- if (ctx->trace_enable) { +- char bits[8]; +- int i; +- for (i = 0; i < len; i++) { +- if (range_min + i == value) +- bits[i] = '0'; +- else +- bits[i] = '1'; +- } +- bits[i] = 0; +- ff_cbs_trace_syntax_element(ctx, put_bits_count(pbc), +- name, NULL, bits, value); +- } +- + if (len > 0) + put_bits(pbc, len, (1 << len) - 1 - (value != range_max)); + ++ CBS_TRACE_WRITE_END_NO_SUBSCRIPTS(); ++ + return 0; + } + +@@ -173,12 +136,11 @@ static int cbs_vp9_read_le(CodedBitstreamContext *ctx, GetBitContext *gbc, + const int *subscripts, uint32_t *write_to) + { + uint32_t value; +- int position, b; ++ int b; + +- av_assert0(width % 8 == 0); ++ CBS_TRACE_READ_START(); + +- if (ctx->trace_enable) +- position = get_bits_count(gbc); ++ av_assert0(width % 8 == 0); + + if (get_bits_left(gbc) < width) { + av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid le value at " +@@ -190,17 +152,7 @@ static int cbs_vp9_read_le(CodedBitstreamContext *ctx, GetBitContext *gbc, + for (b = 0; b < width; b += 8) + value |= get_bits(gbc, 8) << b; + +- if (ctx->trace_enable) { +- char bits[33]; +- int i; +- for (b = 0; b < width; b += 8) +- for (i = 0; i < 8; i++) +- bits[b + i] = value >> (b + i) & 1 ? '1' : '0'; +- bits[b] = 0; +- +- ff_cbs_trace_syntax_element(ctx, position, name, subscripts, +- bits, value); +- } ++ CBS_TRACE_READ_END(); + + *write_to = value; + return 0; +@@ -212,26 +164,18 @@ static int cbs_vp9_write_le(CodedBitstreamContext *ctx, PutBitContext *pbc, + { + int b; + ++ CBS_TRACE_WRITE_START(); ++ + av_assert0(width % 8 == 0); + + if (put_bits_left(pbc) < width) + return AVERROR(ENOSPC); + +- if (ctx->trace_enable) { +- char bits[33]; +- int i; +- for (b = 0; b < width; b += 8) +- for (i = 0; i < 8; i++) +- bits[b + i] = value >> (b + i) & 1 ? '1' : '0'; +- bits[b] = 0; +- +- ff_cbs_trace_syntax_element(ctx, put_bits_count(pbc), +- name, subscripts, bits, value); +- } +- + for (b = 0; b < width; b += 8) + put_bits(pbc, 8, value >> b & 0xff); + ++ CBS_TRACE_WRITE_END(); ++ + return 0; + } + +@@ -251,8 +195,6 @@ static int cbs_vp9_write_le(CodedBitstreamContext *ctx, PutBitContext *pbc, + + #define SUBSCRIPTS(subs, ...) (subs > 0 ? ((int[subs + 1]){ subs, __VA_ARGS__ }) : NULL) + +-#define f(width, name) \ +- xf(width, name, current->name, 0, ) + #define s(width, name) \ + xs(width, name, current->name, 0, ) + #define fs(width, name, subs, ...) \ +@@ -264,6 +206,12 @@ static int cbs_vp9_write_le(CodedBitstreamContext *ctx, PutBitContext *pbc, + #define READWRITE read + #define RWContext GetBitContext + ++#define f(width, name) do { \ ++ uint32_t value; \ ++ CHECK(ff_cbs_read_simple_unsigned(ctx, rw, width, #name, \ ++ &value)); \ ++ current->name = value; \ ++ } while (0) + #define xf(width, name, var, subs, ...) do { \ + uint32_t value; \ + CHECK(ff_cbs_read_unsigned(ctx, rw, width, #name, \ +@@ -329,6 +277,7 @@ static int cbs_vp9_write_le(CodedBitstreamContext *ctx, PutBitContext *pbc, + #undef READ + #undef READWRITE + #undef RWContext ++#undef f + #undef xf + #undef xs + #undef increment +@@ -344,6 +293,10 @@ static int cbs_vp9_write_le(CodedBitstreamContext *ctx, PutBitContext *pbc, + #define READWRITE write + #define RWContext PutBitContext + ++#define f(width, name) do { \ ++ CHECK(ff_cbs_write_simple_unsigned(ctx, rw, width, #name, \ ++ current->name)); \ ++ } while (0) + #define xf(width, name, var, subs, ...) do { \ + CHECK(ff_cbs_write_unsigned(ctx, rw, width, #name, \ + SUBSCRIPTS(subs, __VA_ARGS__), \ +@@ -396,6 +349,7 @@ static int cbs_vp9_write_le(CodedBitstreamContext *ctx, PutBitContext *pbc, + #undef WRITE + #undef READWRITE + #undef RWContext ++#undef f + #undef xf + #undef xs + #undef increment +diff --git a/libavcodec/extract_extradata_bsf.c b/libavcodec/extract_extradata_bsf.c +index 329b1a6..7eedb16 100644 +--- a/libavcodec/extract_extradata_bsf.c ++++ b/libavcodec/extract_extradata_bsf.c +@@ -48,10 +48,9 @@ typedef struct ExtractExtradataContext { + int remove; + } ExtractExtradataContext; + +-static int val_in_array(const int *arr, int len, int val) ++static int val_in_array(const int *arr, size_t len, int val) + { +- int i; +- for (i = 0; i < len; i++) ++ for (size_t i = 0; i < len; i++) + if (arr[i] == val) + return 1; + return 0; +@@ -145,7 +144,7 @@ static int extract_extradata_h2645(AVBSFContext *ctx, AVPacket *pkt, + + int extradata_size = 0, filtered_size = 0; + const int *extradata_nal_types; +- int nb_extradata_nal_types; ++ size_t nb_extradata_nal_types; + int i, has_sps = 0, has_vps = 0, ret = 0; + + if (ctx->par_in->codec_id == AV_CODEC_ID_HEVC) { +diff --git a/libavcodec/trace_headers_bsf.c b/libavcodec/trace_headers_bsf.c +index 028b0a1..8781f5f 100644 +--- a/libavcodec/trace_headers_bsf.c ++++ b/libavcodec/trace_headers_bsf.c +@@ -44,6 +44,8 @@ static int trace_headers_init(AVBSFContext *bsf) + + ctx->cbc->trace_enable = 1; + ctx->cbc->trace_level = AV_LOG_INFO; ++ ctx->cbc->trace_context = ctx->cbc; ++ ctx->cbc->trace_read_callback = ff_cbs_trace_read_log; + + if (bsf->par_in->extradata) { + CodedBitstreamFragment *frag = &ctx->fragment; +diff --git a/libavcodec/vaapi_encode.c b/libavcodec/vaapi_encode.c +index bfca315..f5bf5ab 100644 +--- a/libavcodec/vaapi_encode.c ++++ b/libavcodec/vaapi_encode.c +@@ -276,21 +276,34 @@ static int vaapi_encode_issue(AVCodecContext *avctx, + av_log(avctx, AV_LOG_DEBUG, "Issuing encode for pic %"PRId64"/%"PRId64" " + "as type %s.\n", pic->display_order, pic->encode_order, + picture_type_name[pic->type]); +- if (pic->nb_refs == 0) { ++ if (pic->nb_refs[0] == 0 && pic->nb_refs[1] == 0) { + av_log(avctx, AV_LOG_DEBUG, "No reference pictures.\n"); + } else { +- av_log(avctx, AV_LOG_DEBUG, "Refers to:"); +- for (i = 0; i < pic->nb_refs; i++) { ++ av_log(avctx, AV_LOG_DEBUG, "L0 refers to"); ++ for (i = 0; i < pic->nb_refs[0]; i++) { + av_log(avctx, AV_LOG_DEBUG, " %"PRId64"/%"PRId64, +- pic->refs[i]->display_order, pic->refs[i]->encode_order); ++ pic->refs[0][i]->display_order, pic->refs[0][i]->encode_order); + } + av_log(avctx, AV_LOG_DEBUG, ".\n"); ++ ++ if (pic->nb_refs[1]) { ++ av_log(avctx, AV_LOG_DEBUG, "L1 refers to"); ++ for (i = 0; i < pic->nb_refs[1]; i++) { ++ av_log(avctx, AV_LOG_DEBUG, " %"PRId64"/%"PRId64, ++ pic->refs[1][i]->display_order, pic->refs[1][i]->encode_order); ++ } ++ av_log(avctx, AV_LOG_DEBUG, ".\n"); ++ } + } + + av_assert0(!pic->encode_issued); +- for (i = 0; i < pic->nb_refs; i++) { +- av_assert0(pic->refs[i]); +- av_assert0(pic->refs[i]->encode_issued); ++ for (i = 0; i < pic->nb_refs[0]; i++) { ++ av_assert0(pic->refs[0][i]); ++ av_assert0(pic->refs[0][i]->encode_issued); ++ } ++ for (i = 0; i < pic->nb_refs[1]; i++) { ++ av_assert0(pic->refs[1][i]); ++ av_assert0(pic->refs[1][i]->encode_issued); + } + + av_log(avctx, AV_LOG_DEBUG, "Input surface is %#x.\n", pic->input_surface); +@@ -650,79 +663,200 @@ fail_at_end: + return err; + } + +-static int vaapi_encode_output(AVCodecContext *avctx, +- VAAPIEncodePicture *pic, AVPacket *pkt) ++static int vaapi_encode_set_output_property(AVCodecContext *avctx, ++ VAAPIEncodePicture *pic, ++ AVPacket *pkt) ++{ ++ VAAPIEncodeContext *ctx = avctx->priv_data; ++ ++ if (pic->type == PICTURE_TYPE_IDR) ++ pkt->flags |= AV_PKT_FLAG_KEY; ++ ++ pkt->pts = pic->pts; ++ pkt->duration = pic->duration; ++ ++ // for no-delay encoders this is handled in generic codec ++ if (avctx->codec->capabilities & AV_CODEC_CAP_DELAY && ++ avctx->flags & AV_CODEC_FLAG_COPY_OPAQUE) { ++ pkt->opaque = pic->opaque; ++ pkt->opaque_ref = pic->opaque_ref; ++ pic->opaque_ref = NULL; ++ } ++ ++ if (ctx->codec->flags & FLAG_TIMESTAMP_NO_DELAY) { ++ pkt->dts = pkt->pts; ++ return 0; ++ } ++ ++ if (ctx->output_delay == 0) { ++ pkt->dts = pkt->pts; ++ } else if (pic->encode_order < ctx->decode_delay) { ++ if (ctx->ts_ring[pic->encode_order] < INT64_MIN + ctx->dts_pts_diff) ++ pkt->dts = INT64_MIN; ++ else ++ pkt->dts = ctx->ts_ring[pic->encode_order] - ctx->dts_pts_diff; ++ } else { ++ pkt->dts = ctx->ts_ring[(pic->encode_order - ctx->decode_delay) % ++ (3 * ctx->output_delay + ctx->async_depth)]; ++ } ++ ++ return 0; ++} ++ ++static int vaapi_encode_get_coded_buffer_size(AVCodecContext *avctx, VABufferID buf_id) + { + VAAPIEncodeContext *ctx = avctx->priv_data; + VACodedBufferSegment *buf_list, *buf; ++ int size = 0; + VAStatus vas; +- int total_size = 0; +- uint8_t *ptr; + int err; + +- err = vaapi_encode_wait(avctx, pic); +- if (err < 0) +- return err; +- +- buf_list = NULL; +- vas = vaMapBuffer(ctx->hwctx->display, pic->output_buffer, ++ vas = vaMapBuffer(ctx->hwctx->display, buf_id, + (void**)&buf_list); + if (vas != VA_STATUS_SUCCESS) { + av_log(avctx, AV_LOG_ERROR, "Failed to map output buffers: " + "%d (%s).\n", vas, vaErrorStr(vas)); + err = AVERROR(EIO); +- goto fail; ++ return err; + } + + for (buf = buf_list; buf; buf = buf->next) +- total_size += buf->size; ++ size += buf->size; + +- err = ff_get_encode_buffer(avctx, pkt, total_size, 0); +- ptr = pkt->data; ++ vas = vaUnmapBuffer(ctx->hwctx->display, buf_id); ++ if (vas != VA_STATUS_SUCCESS) { ++ av_log(avctx, AV_LOG_ERROR, "Failed to unmap output buffers: " ++ "%d (%s).\n", vas, vaErrorStr(vas)); ++ err = AVERROR(EIO); ++ return err; ++ } + +- if (err < 0) +- goto fail_mapped; ++ return size; ++} ++ ++static int vaapi_encode_get_coded_buffer_data(AVCodecContext *avctx, ++ VABufferID buf_id, uint8_t **dst) ++{ ++ VAAPIEncodeContext *ctx = avctx->priv_data; ++ VACodedBufferSegment *buf_list, *buf; ++ VAStatus vas; ++ int err; ++ ++ vas = vaMapBuffer(ctx->hwctx->display, buf_id, ++ (void**)&buf_list); ++ if (vas != VA_STATUS_SUCCESS) { ++ av_log(avctx, AV_LOG_ERROR, "Failed to map output buffers: " ++ "%d (%s).\n", vas, vaErrorStr(vas)); ++ err = AVERROR(EIO); ++ return err; ++ } + + for (buf = buf_list; buf; buf = buf->next) { + av_log(avctx, AV_LOG_DEBUG, "Output buffer: %u bytes " + "(status %08x).\n", buf->size, buf->status); + +- memcpy(ptr, buf->buf, buf->size); +- ptr += buf->size; ++ memcpy(*dst, buf->buf, buf->size); ++ *dst += buf->size; + } + +- if (pic->type == PICTURE_TYPE_IDR) +- pkt->flags |= AV_PKT_FLAG_KEY; +- +- pkt->pts = pic->pts; +- pkt->duration = pic->duration; +- +- vas = vaUnmapBuffer(ctx->hwctx->display, pic->output_buffer); ++ vas = vaUnmapBuffer(ctx->hwctx->display, buf_id); + if (vas != VA_STATUS_SUCCESS) { + av_log(avctx, AV_LOG_ERROR, "Failed to unmap output buffers: " + "%d (%s).\n", vas, vaErrorStr(vas)); + err = AVERROR(EIO); +- goto fail; ++ return err; + } + +- // for no-delay encoders this is handled in generic codec +- if (avctx->codec->capabilities & AV_CODEC_CAP_DELAY && +- avctx->flags & AV_CODEC_FLAG_COPY_OPAQUE) { +- pkt->opaque = pic->opaque; +- pkt->opaque_ref = pic->opaque_ref; +- pic->opaque_ref = NULL; ++ return 0; ++} ++ ++static int vaapi_encode_get_coded_data(AVCodecContext *avctx, ++ VAAPIEncodePicture *pic, AVPacket *pkt) ++{ ++ VAAPIEncodeContext *ctx = avctx->priv_data; ++ VABufferID output_buffer_prev; ++ int total_size = 0; ++ uint8_t *ptr; ++ int ret; ++ ++ if (ctx->coded_buffer_ref) { ++ output_buffer_prev = (VABufferID)(uintptr_t)ctx->coded_buffer_ref->data; ++ ret = vaapi_encode_get_coded_buffer_size(avctx, output_buffer_prev); ++ if (ret < 0) ++ goto end; ++ total_size += ret; ++ } ++ ++ ret = vaapi_encode_get_coded_buffer_size(avctx, pic->output_buffer); ++ if (ret < 0) ++ goto end; ++ total_size += ret; ++ ++ ret = ff_get_encode_buffer(avctx, pkt, total_size, 0); ++ if (ret < 0) ++ goto end; ++ ptr = pkt->data; ++ ++ if (ctx->coded_buffer_ref) { ++ ret = vaapi_encode_get_coded_buffer_data(avctx, output_buffer_prev, &ptr); ++ if (ret < 0) ++ goto end; + } + ++ ret = vaapi_encode_get_coded_buffer_data(avctx, pic->output_buffer, &ptr); ++ if (ret < 0) ++ goto end; ++ ++end: ++ if (ctx->coded_buffer_ref) { ++ av_buffer_unref(&ctx->coded_buffer_ref); ++ } + av_buffer_unref(&pic->output_buffer_ref); + pic->output_buffer = VA_INVALID_ID; + ++ return ret; ++} ++ ++static int vaapi_encode_output(AVCodecContext *avctx, ++ VAAPIEncodePicture *pic, AVPacket *pkt) ++{ ++ VAAPIEncodeContext *ctx = avctx->priv_data; ++ AVPacket *pkt_ptr = pkt; ++ int err; ++ ++ err = vaapi_encode_wait(avctx, pic); ++ if (err < 0) ++ return err; ++ ++ if (pic->non_independent_frame) { ++ av_assert0(!ctx->coded_buffer_ref); ++ ctx->coded_buffer_ref = av_buffer_ref(pic->output_buffer_ref); ++ ++ if (pic->tail_size) { ++ if (ctx->tail_pkt->size) { ++ err = AVERROR(AVERROR_BUG); ++ goto end; ++ } ++ ++ err = ff_get_encode_buffer(avctx, ctx->tail_pkt, pic->tail_size, 0); ++ if (err < 0) ++ goto end; ++ ++ memcpy(ctx->tail_pkt->data, pic->tail_data, pic->tail_size); ++ pkt_ptr = ctx->tail_pkt; ++ } ++ } else { ++ err = vaapi_encode_get_coded_data(avctx, pic, pkt); ++ if (err < 0) ++ goto end; ++ } ++ + av_log(avctx, AV_LOG_DEBUG, "Output read for pic %"PRId64"/%"PRId64".\n", + pic->display_order, pic->encode_order); +- return 0; + +-fail_mapped: +- vaUnmapBuffer(ctx->hwctx->display, pic->output_buffer); +-fail: ++ vaapi_encode_set_output_property(avctx, pic, pkt_ptr); ++ ++end: + av_buffer_unref(&pic->output_buffer_ref); + pic->output_buffer = VA_INVALID_ID; + return err; +@@ -811,8 +945,12 @@ static void vaapi_encode_add_ref(AVCodecContext *avctx, + + if (is_ref) { + av_assert0(pic != target); +- av_assert0(pic->nb_refs < MAX_PICTURE_REFERENCES); +- pic->refs[pic->nb_refs++] = target; ++ av_assert0(pic->nb_refs[0] < MAX_PICTURE_REFERENCES && ++ pic->nb_refs[1] < MAX_PICTURE_REFERENCES); ++ if (target->display_order < pic->display_order) ++ pic->refs[0][pic->nb_refs[0]++] = target; ++ else ++ pic->refs[1][pic->nb_refs[1]++] = target; + ++refs; + } + +@@ -841,10 +979,16 @@ static void vaapi_encode_remove_refs(AVCodecContext *avctx, + if (pic->ref_removed[level]) + return; + +- for (i = 0; i < pic->nb_refs; i++) { +- av_assert0(pic->refs[i]); +- --pic->refs[i]->ref_count[level]; +- av_assert0(pic->refs[i]->ref_count[level] >= 0); ++ for (i = 0; i < pic->nb_refs[0]; i++) { ++ av_assert0(pic->refs[0][i]); ++ --pic->refs[0][i]->ref_count[level]; ++ av_assert0(pic->refs[0][i]->ref_count[level] >= 0); ++ } ++ ++ for (i = 0; i < pic->nb_refs[1]; i++) { ++ av_assert0(pic->refs[1][i]); ++ --pic->refs[1][i]->ref_count[level]; ++ av_assert0(pic->refs[1][i]->ref_count[level] >= 0); + } + + for (i = 0; i < pic->nb_dpb_pics; i++) { +@@ -889,7 +1033,7 @@ static void vaapi_encode_set_b_pictures(AVCodecContext *avctx, + vaapi_encode_add_ref(avctx, pic, end, 1, 1, 0); + vaapi_encode_add_ref(avctx, pic, prev, 0, 0, 1); + +- for (ref = end->refs[1]; ref; ref = ref->refs[1]) ++ for (ref = end->refs[1][0]; ref; ref = ref->refs[1][0]) + vaapi_encode_add_ref(avctx, pic, ref, 0, 1, 0); + } + *last = prev; +@@ -912,7 +1056,7 @@ static void vaapi_encode_set_b_pictures(AVCodecContext *avctx, + vaapi_encode_add_ref(avctx, pic, end, 1, 1, 0); + vaapi_encode_add_ref(avctx, pic, prev, 0, 0, 1); + +- for (ref = end->refs[1]; ref; ref = ref->refs[1]) ++ for (ref = end->refs[1][0]; ref; ref = ref->refs[1][0]) + vaapi_encode_add_ref(avctx, pic, ref, 0, 1, 0); + + if (i > 1) +@@ -926,11 +1070,44 @@ static void vaapi_encode_set_b_pictures(AVCodecContext *avctx, + } + } + ++static void vaapi_encode_add_next_prev(AVCodecContext *avctx, ++ VAAPIEncodePicture *pic) ++{ ++ VAAPIEncodeContext *ctx = avctx->priv_data; ++ int i; ++ ++ if (!pic) ++ return; ++ ++ if (pic->type == PICTURE_TYPE_IDR) { ++ for (i = 0; i < ctx->nb_next_prev; i++) { ++ --ctx->next_prev[i]->ref_count[0]; ++ ctx->next_prev[i] = NULL; ++ } ++ ctx->next_prev[0] = pic; ++ ++pic->ref_count[0]; ++ ctx->nb_next_prev = 1; ++ ++ return; ++ } ++ ++ if (ctx->nb_next_prev < MAX_PICTURE_REFERENCES) { ++ ctx->next_prev[ctx->nb_next_prev++] = pic; ++ ++pic->ref_count[0]; ++ } else { ++ --ctx->next_prev[0]->ref_count[0]; ++ for (i = 0; i < MAX_PICTURE_REFERENCES - 1; i++) ++ ctx->next_prev[i] = ctx->next_prev[i + 1]; ++ ctx->next_prev[i] = pic; ++ ++pic->ref_count[0]; ++ } ++} ++ + static int vaapi_encode_pick_next(AVCodecContext *avctx, + VAAPIEncodePicture **pic_out) + { + VAAPIEncodeContext *ctx = avctx->priv_data; +- VAAPIEncodePicture *pic = NULL, *next, *start; ++ VAAPIEncodePicture *pic = NULL, *prev = NULL, *next, *start; + int i, b_counter, closed_gop_end; + + // If there are any B-frames already queued, the next one to encode +@@ -941,11 +1118,18 @@ static int vaapi_encode_pick_next(AVCodecContext *avctx, + continue; + if (pic->type != PICTURE_TYPE_B) + continue; +- for (i = 0; i < pic->nb_refs; i++) { +- if (!pic->refs[i]->encode_issued) ++ for (i = 0; i < pic->nb_refs[0]; i++) { ++ if (!pic->refs[0][i]->encode_issued) ++ break; ++ } ++ if (i != pic->nb_refs[0]) ++ continue; ++ ++ for (i = 0; i < pic->nb_refs[1]; i++) { ++ if (!pic->refs[1][i]->encode_issued) + break; + } +- if (i == pic->nb_refs) ++ if (i == pic->nb_refs[1]) + break; + } + +@@ -1044,21 +1228,30 @@ static int vaapi_encode_pick_next(AVCodecContext *avctx, + + vaapi_encode_add_ref(avctx, pic, pic, 0, 1, 0); + if (pic->type != PICTURE_TYPE_IDR) { +- vaapi_encode_add_ref(avctx, pic, start, +- pic->type == PICTURE_TYPE_P, +- b_counter > 0, 0); +- vaapi_encode_add_ref(avctx, pic, ctx->next_prev, 0, 0, 1); ++ // TODO: apply both previous and forward multi reference for all vaapi encoders. ++ // And L0/L1 reference frame number can be set dynamically through query ++ // VAConfigAttribEncMaxRefFrames attribute. ++ if (avctx->codec_id == AV_CODEC_ID_AV1) { ++ for (i = 0; i < ctx->nb_next_prev; i++) ++ vaapi_encode_add_ref(avctx, pic, ctx->next_prev[i], ++ pic->type == PICTURE_TYPE_P, ++ b_counter > 0, 0); ++ } else ++ vaapi_encode_add_ref(avctx, pic, start, ++ pic->type == PICTURE_TYPE_P, ++ b_counter > 0, 0); ++ ++ vaapi_encode_add_ref(avctx, pic, ctx->next_prev[ctx->nb_next_prev - 1], 0, 0, 1); + } +- if (ctx->next_prev) +- --ctx->next_prev->ref_count[0]; + + if (b_counter > 0) { + vaapi_encode_set_b_pictures(avctx, start, pic, pic, 1, +- &ctx->next_prev); ++ &prev); + } else { +- ctx->next_prev = pic; ++ prev = pic; + } +- ++ctx->next_prev->ref_count[0]; ++ vaapi_encode_add_next_prev(avctx, prev); ++ + return 0; + } + +@@ -1205,10 +1398,23 @@ fail: + int ff_vaapi_encode_receive_packet(AVCodecContext *avctx, AVPacket *pkt) + { + VAAPIEncodeContext *ctx = avctx->priv_data; +- VAAPIEncodePicture *pic; ++ VAAPIEncodePicture *pic = NULL; + AVFrame *frame = ctx->frame; + int err; + ++start: ++ /** if no B frame before repeat P frame, sent repeat P frame out. */ ++ if (ctx->tail_pkt->size) { ++ for (VAAPIEncodePicture *tmp = ctx->pic_start; tmp; tmp = tmp->next) { ++ if (tmp->type == PICTURE_TYPE_B && tmp->pts < ctx->tail_pkt->pts) ++ break; ++ else if (!tmp->next) { ++ av_packet_move_ref(pkt, ctx->tail_pkt); ++ goto end; ++ } ++ } ++ } ++ + err = ff_encode_get_frame(avctx, frame); + if (err < 0 && err != AVERROR_EOF) + return err; +@@ -1228,8 +1434,6 @@ int ff_vaapi_encode_receive_packet(AVCodecContext *avctx, AVPacket *pkt) + } + + if (ctx->has_sync_buffer_func) { +- pic = NULL; +- + if (av_fifo_can_write(ctx->encode_fifo)) { + err = vaapi_encode_pick_next(avctx, &pic); + if (!err) { +@@ -1255,7 +1459,6 @@ int ff_vaapi_encode_receive_packet(AVCodecContext *avctx, AVPacket *pkt) + av_fifo_read(ctx->encode_fifo, &pic, 1); + ctx->encode_order = pic->encode_order + 1; + } else { +- pic = NULL; + err = vaapi_encode_pick_next(avctx, &pic); + if (err < 0) + return err; +@@ -1276,27 +1479,21 @@ int ff_vaapi_encode_receive_packet(AVCodecContext *avctx, AVPacket *pkt) + return err; + } + +- if (ctx->output_delay == 0) { +- pkt->dts = pkt->pts; +- } else if (pic->encode_order < ctx->decode_delay) { +- if (ctx->ts_ring[pic->encode_order] < INT64_MIN + ctx->dts_pts_diff) +- pkt->dts = INT64_MIN; +- else +- pkt->dts = ctx->ts_ring[pic->encode_order] - ctx->dts_pts_diff; +- } else { +- pkt->dts = ctx->ts_ring[(pic->encode_order - ctx->decode_delay) % +- (3 * ctx->output_delay + ctx->async_depth)]; +- } +- av_log(avctx, AV_LOG_DEBUG, "Output packet: pts %"PRId64" dts %"PRId64".\n", +- pkt->pts, pkt->dts); +- + ctx->output_order = pic->encode_order; + vaapi_encode_clear_old(avctx); + ++ /** loop to get an available pkt in encoder flushing. */ ++ if (ctx->end_of_stream && !pkt->size) ++ goto start; ++ ++end: ++ if (pkt->size) ++ av_log(avctx, AV_LOG_DEBUG, "Output packet: pts %"PRId64", dts %"PRId64", " ++ "size %d bytes.\n", pkt->pts, pkt->dts, pkt->size); ++ + return 0; + } + +- + static av_cold void vaapi_encode_add_global_param(AVCodecContext *avctx, int type, + void *buffer, size_t size) + { +@@ -2597,6 +2794,12 @@ av_cold int ff_vaapi_encode_init(AVCodecContext *avctx) + ctx->device = (AVHWDeviceContext*)ctx->device_ref->data; + ctx->hwctx = ctx->device->hwctx; + ++ ctx->tail_pkt = av_packet_alloc(); ++ if (!ctx->tail_pkt) { ++ err = AVERROR(ENOMEM); ++ goto fail; ++ } ++ + err = vaapi_encode_profile_entrypoint(avctx); + if (err < 0) + goto fail; +@@ -2789,6 +2992,7 @@ av_cold int ff_vaapi_encode_close(AVCodecContext *avctx) + } + + av_frame_free(&ctx->frame); ++ av_packet_free(&ctx->tail_pkt); + + av_freep(&ctx->codec_sequence_params); + av_freep(&ctx->codec_picture_params); +diff --git a/libavcodec/vaapi_encode.h b/libavcodec/vaapi_encode.h +index a1e639f..416a3ce 100644 +--- a/libavcodec/vaapi_encode.h ++++ b/libavcodec/vaapi_encode.h +@@ -49,6 +49,7 @@ enum { + // A.4.1: table A.6 allows at most 20 tile columns for any level. + MAX_TILE_COLS = 20, + MAX_ASYNC_DEPTH = 64, ++ MAX_REFERENCE_LIST_NUM = 2, + }; + + extern const AVCodecHWConfigInternal *const ff_vaapi_encode_hw_configs[]; +@@ -116,10 +117,11 @@ typedef struct VAAPIEncodePicture { + // but not if it isn't. + int nb_dpb_pics; + struct VAAPIEncodePicture *dpb[MAX_DPB_SIZE]; +- // The reference pictures used in decoding this picture. If they are +- // used by later pictures they will also appear in the DPB. +- int nb_refs; +- struct VAAPIEncodePicture *refs[MAX_PICTURE_REFERENCES]; ++ // The reference pictures used in decoding this picture. If they are ++ // used by later pictures they will also appear in the DPB. ref[0][] for ++ // previous reference frames. ref[1][] for future reference frames. ++ int nb_refs[MAX_REFERENCE_LIST_NUM]; ++ struct VAAPIEncodePicture *refs[MAX_REFERENCE_LIST_NUM][MAX_PICTURE_REFERENCES]; + // The previous reference picture in encode order. Must be in at least + // one of the reference list and DPB list. + struct VAAPIEncodePicture *prev; +@@ -131,6 +133,17 @@ typedef struct VAAPIEncodePicture { + + int nb_slices; + VAAPIEncodeSlice *slices; ++ ++ /** ++ * indicate if current frame is an independent frame that the coded data ++ * can be pushed to downstream directly. Coded of non-independent frame ++ * data will be concatenated into next independent frame. ++ */ ++ int non_independent_frame; ++ /** Tail data of current pic, used only for repeat header of AV1. */ ++ char tail_data[MAX_PARAM_BUFFER_SIZE]; ++ /** Byte length of tail_data. */ ++ size_t tail_size; + } VAAPIEncodePicture; + + typedef struct VAAPIEncodeProfile { +@@ -290,8 +303,9 @@ typedef struct VAAPIEncodeContext { + // Current encoding window, in display (input) order. + VAAPIEncodePicture *pic_start, *pic_end; + // The next picture to use as the previous reference picture in +- // encoding order. +- VAAPIEncodePicture *next_prev; ++ // encoding order. Order from small to large in encoding order. ++ VAAPIEncodePicture *next_prev[MAX_PICTURE_REFERENCES]; ++ int nb_next_prev; + + // Next input order index (display order). + int64_t input_order; +@@ -364,6 +378,16 @@ typedef struct VAAPIEncodeContext { + AVFifo *encode_fifo; + // Max number of frame buffered in encoder. + int async_depth; ++ ++ /** Head data for current output pkt, used only for AV1. */ ++ //void *header_data; ++ //size_t header_data_size; ++ ++ /** Buffered coded data of a pic if it is an non-independent frame. */ ++ AVBufferRef *coded_buffer_ref; ++ ++ /** Tail data of a pic, now only used for av1 repeat frame header. */ ++ AVPacket *tail_pkt; + } VAAPIEncodeContext; + + enum { +@@ -380,6 +404,9 @@ enum { + // Codec supports non-IDR key pictures (that is, key pictures do + // not necessarily empty the DPB). + FLAG_NON_IDR_KEY_PICTURES = 1 << 5, ++ // Codec output packet without timestamp delay, which means the ++ // output packet has same PTS and DTS. ++ FLAG_TIMESTAMP_NO_DELAY = 1 << 6, + }; + + typedef struct VAAPIEncodeType { +diff --git a/libavcodec/vaapi_encode_av1.c b/libavcodec/vaapi_encode_av1.c +new file mode 100644 +index 0000000..9d101fa +--- /dev/null ++++ b/libavcodec/vaapi_encode_av1.c +@@ -0,0 +1,949 @@ ++/* ++ * Copyright (c) 2023 Intel Corporation ++ * ++ * This file is part of FFmpeg. ++ * ++ * FFmpeg is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * FFmpeg is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with FFmpeg; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ */ ++ ++#include ++#include ++ ++#include "libavutil/pixdesc.h" ++#include "libavutil/opt.h" ++ ++#include "cbs_av1.h" ++#include "put_bits.h" ++#include "codec_internal.h" ++#include "av1_levels.h" ++#include "vaapi_encode.h" ++ ++#define AV1_MAX_QUANT 255 ++ ++typedef struct VAAPIEncodeAV1Picture { ++ int64_t last_idr_frame; ++ int slot; ++} VAAPIEncodeAV1Picture; ++ ++typedef struct VAAPIEncodeAV1Context { ++ VAAPIEncodeContext common; ++ AV1RawOBU sh; /**< sequence header.*/ ++ AV1RawOBU fh; /**< frame header.*/ ++ CodedBitstreamContext *cbc; ++ CodedBitstreamFragment current_obu; ++ VAConfigAttribValEncAV1 attr; ++ VAConfigAttribValEncAV1Ext1 attr_ext1; ++ VAConfigAttribValEncAV1Ext2 attr_ext2; ++ ++ char sh_data[MAX_PARAM_BUFFER_SIZE]; /**< coded sequence header data. */ ++ size_t sh_data_len; /**< bit length of sh_data. */ ++ char fh_data[MAX_PARAM_BUFFER_SIZE]; /**< coded frame header data. */ ++ size_t fh_data_len; /**< bit length of fh_data. */ ++ ++ uint8_t uniform_tile; ++ uint8_t use_128x128_superblock; ++ int sb_cols; ++ int sb_rows; ++ int tile_cols_log2; ++ int tile_rows_log2; ++ int max_tile_width_sb; ++ int max_tile_height_sb; ++ uint8_t width_in_sbs_minus_1[AV1_MAX_TILE_COLS]; ++ uint8_t height_in_sbs_minus_1[AV1_MAX_TILE_ROWS]; ++ ++ int min_log2_tile_cols; ++ int max_log2_tile_cols; ++ int min_log2_tile_rows; ++ int max_log2_tile_rows; ++ ++ int q_idx_idr; ++ int q_idx_p; ++ int q_idx_b; ++ ++ /** bit positions in current frame header */ ++ int qindex_offset; ++ int loopfilter_offset; ++ int cdef_start_offset; ++ int cdef_param_size; ++ ++ /** user options */ ++ int profile; ++ int level; ++ int tier; ++ int tile_cols, tile_rows; ++ int tile_groups; ++} VAAPIEncodeAV1Context; ++ ++static void vaapi_encode_av1_trace_write_log(void *ctx, ++ PutBitContext *pbc, int length, ++ const char *str, const int *subscripts, ++ int64_t value) ++{ ++ VAAPIEncodeAV1Context *priv = ctx; ++ int position; ++ ++ position = put_bits_count(pbc); ++ av_assert0(position >= length); ++ ++ if (!strcmp(str, "base_q_idx")) ++ priv->qindex_offset = position - length; ++ else if (!strcmp(str, "loop_filter_level[0]")) ++ priv->loopfilter_offset = position - length; ++ else if (!strcmp(str, "cdef_damping_minus_3")) ++ priv->cdef_start_offset = position - length; ++ else if (!strcmp(str, "cdef_uv_sec_strength[i]")) ++ priv->cdef_param_size = position - priv->cdef_start_offset; ++} ++ ++static av_cold int vaapi_encode_av1_get_encoder_caps(AVCodecContext *avctx) ++{ ++ VAAPIEncodeContext *ctx = avctx->priv_data; ++ VAAPIEncodeAV1Context *priv = avctx->priv_data; ++ ++ // Surfaces must be aligned to superblock boundaries. ++ ctx->surface_width = FFALIGN(avctx->width, priv->use_128x128_superblock ? 128 : 64); ++ ctx->surface_height = FFALIGN(avctx->height, priv->use_128x128_superblock ? 128 : 64); ++ ++ return 0; ++} ++ ++static av_cold int vaapi_encode_av1_configure(AVCodecContext *avctx) ++{ ++ VAAPIEncodeContext *ctx = avctx->priv_data; ++ VAAPIEncodeAV1Context *priv = avctx->priv_data; ++ int ret; ++ ++ ret = ff_cbs_init(&priv->cbc, AV_CODEC_ID_AV1, avctx); ++ if (ret < 0) ++ return ret; ++ priv->cbc->trace_enable = 1; ++ priv->cbc->trace_level = AV_LOG_DEBUG; ++ priv->cbc->trace_context = ctx; ++ priv->cbc->trace_write_callback = vaapi_encode_av1_trace_write_log; ++ ++ if (ctx->rc_mode->quality) { ++ priv->q_idx_p = av_clip(ctx->rc_quality, 0, AV1_MAX_QUANT); ++ if (fabs(avctx->i_quant_factor) > 0.0) ++ priv->q_idx_idr = ++ av_clip((fabs(avctx->i_quant_factor) * priv->q_idx_p + ++ avctx->i_quant_offset) + 0.5, ++ 0, AV1_MAX_QUANT); ++ else ++ priv->q_idx_idr = priv->q_idx_p; ++ ++ if (fabs(avctx->b_quant_factor) > 0.0) ++ priv->q_idx_b = ++ av_clip((fabs(avctx->b_quant_factor) * priv->q_idx_p + ++ avctx->b_quant_offset) + 0.5, ++ 0, AV1_MAX_QUANT); ++ else ++ priv->q_idx_b = priv->q_idx_p; ++ } else { ++ /** Arbitrary value */ ++ priv->q_idx_idr = priv->q_idx_p = priv->q_idx_b = 128; ++ } ++ ++ return 0; ++} ++ ++static int vaapi_encode_av1_add_obu(AVCodecContext *avctx, ++ CodedBitstreamFragment *au, ++ uint8_t type, ++ void *obu_unit) ++{ ++ int ret; ++ ++ ret = ff_cbs_insert_unit_content(au, -1, ++ type, obu_unit, NULL); ++ if (ret < 0) { ++ av_log(avctx, AV_LOG_ERROR, "Failed to add OBU unit: " ++ "type = %d.\n", type); ++ return ret; ++ } ++ ++ return 0; ++} ++ ++static int vaapi_encode_av1_write_obu(AVCodecContext *avctx, ++ char *data, size_t *data_len, ++ CodedBitstreamFragment *bs) ++{ ++ VAAPIEncodeAV1Context *priv = avctx->priv_data; ++ int ret; ++ ++ ret = ff_cbs_write_fragment_data(priv->cbc, bs); ++ if (ret < 0) { ++ av_log(avctx, AV_LOG_ERROR, "Failed to write packed header.\n"); ++ return ret; ++ } ++ ++ if ((size_t)8 * MAX_PARAM_BUFFER_SIZE < 8 * bs->data_size - bs->data_bit_padding) { ++ av_log(avctx, AV_LOG_ERROR, "Access unit too large: " ++ "%zu < %zu.\n", (size_t)8 * MAX_PARAM_BUFFER_SIZE, ++ 8 * bs->data_size - bs->data_bit_padding); ++ return AVERROR(ENOSPC); ++ } ++ ++ memcpy(data, bs->data, bs->data_size); ++ *data_len = 8 * bs->data_size - bs->data_bit_padding; ++ ++ return 0; ++} ++ ++static int tile_log2(int blkSize, int target) { ++ int k; ++ for (k = 0; (blkSize << k) < target; k++); ++ return k; ++} ++ ++static int vaapi_encode_av1_set_tile(AVCodecContext *avctx) ++{ ++ VAAPIEncodeAV1Context *priv = avctx->priv_data; ++ int mi_cols, mi_rows, sb_shift, sb_size; ++ int max_tile_area_sb, max_tile_area_sb_varied; ++ int tile_width_sb, tile_height_sb, widest_tile_sb; ++ int tile_cols, tile_rows; ++ int min_log2_tiles; ++ int i; ++ ++ if (priv->tile_cols > AV1_MAX_TILE_COLS || ++ priv->tile_rows > AV1_MAX_TILE_ROWS) { ++ av_log(avctx, AV_LOG_ERROR, "Invalid tile number %dx%d, should less than %dx%d.\n", ++ priv->tile_cols, priv->tile_rows, AV1_MAX_TILE_COLS, AV1_MAX_TILE_ROWS); ++ return AVERROR(EINVAL); ++ } ++ ++ mi_cols = 2 * ((avctx->width + 7) >> 3); ++ mi_rows = 2 * ((avctx->height + 7) >> 3); ++ priv->sb_cols = priv->use_128x128_superblock ? ++ ((mi_cols + 31) >> 5) : ((mi_cols + 15) >> 4); ++ priv->sb_rows = priv->use_128x128_superblock ? ++ ((mi_rows + 31) >> 5) : ((mi_rows + 15) >> 4); ++ sb_shift = priv->use_128x128_superblock ? 5 : 4; ++ sb_size = sb_shift + 2; ++ priv->max_tile_width_sb = AV1_MAX_TILE_WIDTH >> sb_size; ++ max_tile_area_sb = AV1_MAX_TILE_AREA >> (2 * sb_size); ++ ++ priv->min_log2_tile_cols = tile_log2(priv->max_tile_width_sb, priv->sb_cols); ++ priv->max_log2_tile_cols = tile_log2(1, FFMIN(priv->sb_cols, AV1_MAX_TILE_COLS)); ++ priv->max_log2_tile_rows = tile_log2(1, FFMIN(priv->sb_rows, AV1_MAX_TILE_ROWS)); ++ min_log2_tiles = FFMAX(priv->min_log2_tile_cols, ++ tile_log2(max_tile_area_sb, priv->sb_rows * priv->sb_cols)); ++ ++ tile_cols = av_clip(priv->tile_cols, (priv->sb_cols + priv->max_tile_width_sb - 1) / priv->max_tile_width_sb, priv->sb_cols); ++ ++ if (!priv->tile_cols) ++ priv->tile_cols = tile_cols; ++ else if (priv->tile_cols != tile_cols){ ++ av_log(avctx, AV_LOG_ERROR, "Invalid tile cols %d, should be in range of %d~%d\n", ++ priv->tile_cols, ++ (priv->sb_cols + priv->max_tile_width_sb - 1) / priv->max_tile_width_sb, ++ priv->sb_cols); ++ return AVERROR(EINVAL); ++ } ++ ++ priv->tile_cols_log2 = tile_log2(1, priv->tile_cols); ++ tile_width_sb = (priv->sb_cols + (1 << priv->tile_cols_log2) - 1) >> ++ priv->tile_cols_log2; ++ ++ if (priv->tile_rows > priv->sb_rows) { ++ av_log(avctx, AV_LOG_ERROR, "Invalid tile rows %d, should be less than %d.\n", ++ priv->tile_rows, priv->sb_rows); ++ return AVERROR(EINVAL); ++ } ++ ++ /** Try user setting tile rows number first. */ ++ tile_rows = priv->tile_rows ? priv->tile_rows : 1; ++ for (; tile_rows <= priv->sb_rows && tile_rows <= AV1_MAX_TILE_ROWS; tile_rows++) { ++ /** try uniformed tile. */ ++ priv->tile_rows_log2 = tile_log2(1, tile_rows); ++ if ((priv->sb_cols + tile_width_sb - 1) / tile_width_sb == priv->tile_cols) { ++ for (i = 0; i < priv->tile_cols - 1; i++) ++ priv->width_in_sbs_minus_1[i] = tile_width_sb - 1; ++ priv->width_in_sbs_minus_1[i] = priv->sb_cols - (priv->tile_cols - 1) * tile_width_sb - 1; ++ ++ tile_height_sb = (priv->sb_rows + (1 << priv->tile_rows_log2) - 1) >> ++ priv->tile_rows_log2; ++ ++ if ((priv->sb_rows + tile_height_sb - 1) / tile_height_sb == tile_rows && ++ tile_height_sb <= max_tile_area_sb / tile_width_sb) { ++ for (i = 0; i < tile_rows - 1; i++) ++ priv->height_in_sbs_minus_1[i] = tile_height_sb - 1; ++ priv->height_in_sbs_minus_1[i] = priv->sb_rows - (tile_rows - 1) * tile_height_sb - 1; ++ ++ priv->uniform_tile = 1; ++ priv->min_log2_tile_rows = FFMAX(min_log2_tiles - priv->tile_cols_log2, 0); ++ ++ break; ++ } ++ } ++ ++ /** try non-uniformed tile. */ ++ widest_tile_sb = 0; ++ for (i = 0; i < priv->tile_cols; i++) { ++ priv->width_in_sbs_minus_1[i] = (i + 1) * priv->sb_cols / priv->tile_cols - i * priv->sb_cols / priv->tile_cols - 1; ++ widest_tile_sb = FFMAX(widest_tile_sb, priv->width_in_sbs_minus_1[i] + 1); ++ } ++ ++ if (min_log2_tiles) ++ max_tile_area_sb_varied = (priv->sb_rows * priv->sb_cols) >> (min_log2_tiles + 1); ++ else ++ max_tile_area_sb_varied = priv->sb_rows * priv->sb_cols; ++ priv->max_tile_height_sb = FFMAX(1, max_tile_area_sb_varied / widest_tile_sb); ++ ++ if (tile_rows == av_clip(tile_rows, (priv->sb_rows + priv->max_tile_height_sb - 1) / priv->max_tile_height_sb, priv->sb_rows)) { ++ for (i = 0; i < tile_rows; i++) ++ priv->height_in_sbs_minus_1[i] = (i + 1) * priv->sb_rows / tile_rows - i * priv->sb_rows / tile_rows - 1; ++ ++ break; ++ } ++ ++ /** Return invalid parameter if explicit tile rows is set. */ ++ if (priv->tile_rows) { ++ av_log(avctx, AV_LOG_ERROR, "Invalid tile rows %d.\n", priv->tile_rows); ++ return AVERROR(EINVAL); ++ } ++ } ++ ++ priv->tile_rows = tile_rows; ++ av_log(avctx, AV_LOG_DEBUG, "Setting tile cols/rows to %d/%d.\n", ++ priv->tile_cols, priv->tile_rows); ++ ++ /** check if tile cols/rows is supported by driver. */ ++ if (priv->attr_ext2.bits.max_tile_num_minus1) { ++ if ((priv->tile_cols * priv->tile_rows - 1) > priv->attr_ext2.bits.max_tile_num_minus1) { ++ av_log(avctx, AV_LOG_ERROR, "Unsupported tile num %d * %d = %d by driver, " ++ "should be at most %d.\n", priv->tile_cols, priv->tile_rows, ++ priv->tile_cols * priv->tile_rows, ++ priv->attr_ext2.bits.max_tile_num_minus1 + 1); ++ return AVERROR(EINVAL); ++ } ++ } ++ ++ /** check if tile group numbers is valid. */ ++ if (priv->tile_groups > priv->tile_cols * priv->tile_rows) { ++ av_log(avctx, AV_LOG_WARNING, "Invalid tile groups number %d, " ++ "correct to %d.\n", priv->tile_groups, priv->tile_cols * priv->tile_rows); ++ priv->tile_groups = priv->tile_cols * priv->tile_rows; ++ } ++ ++ return 0; ++} ++ ++static int vaapi_encode_av1_write_sequence_header(AVCodecContext *avctx, ++ char *data, size_t *data_len) ++{ ++ VAAPIEncodeAV1Context *priv = avctx->priv_data; ++ ++ memcpy(data, &priv->sh_data, MAX_PARAM_BUFFER_SIZE * sizeof(char)); ++ *data_len = priv->sh_data_len; ++ ++ return 0; ++} ++ ++static int vaapi_encode_av1_init_sequence_params(AVCodecContext *avctx) ++{ ++ VAAPIEncodeContext *ctx = avctx->priv_data; ++ VAAPIEncodeAV1Context *priv = avctx->priv_data; ++ AV1RawOBU *sh_obu = &priv->sh; ++ AV1RawSequenceHeader *sh = &sh_obu->obu.sequence_header; ++ VAEncSequenceParameterBufferAV1 *vseq = ctx->codec_sequence_params; ++ CodedBitstreamFragment *obu = &priv->current_obu; ++ const AVPixFmtDescriptor *desc; ++ int ret; ++ ++ memset(sh_obu, 0, sizeof(*sh_obu)); ++ sh_obu->header.obu_type = AV1_OBU_SEQUENCE_HEADER; ++ ++ desc = av_pix_fmt_desc_get(priv->common.input_frames->sw_format); ++ av_assert0(desc); ++ ++ sh->seq_profile = avctx->profile; ++ if (!sh->seq_force_screen_content_tools) ++ sh->seq_force_integer_mv = AV1_SELECT_INTEGER_MV; ++ sh->frame_width_bits_minus_1 = av_log2(avctx->width); ++ sh->frame_height_bits_minus_1 = av_log2(avctx->height); ++ sh->max_frame_width_minus_1 = avctx->width - 1; ++ sh->max_frame_height_minus_1 = avctx->height - 1; ++ sh->seq_tier[0] = priv->tier; ++ /** enable order hint and reserve maximum 8 bits for it by default. */ ++ sh->enable_order_hint = 1; ++ sh->order_hint_bits_minus_1 = 7; ++ ++ sh->color_config = (AV1RawColorConfig) { ++ .high_bitdepth = desc->comp[0].depth == 8 ? 0 : 1, ++ .color_primaries = avctx->color_primaries, ++ .transfer_characteristics = avctx->color_trc, ++ .matrix_coefficients = avctx->colorspace, ++ .color_description_present_flag = (avctx->color_primaries != AVCOL_PRI_UNSPECIFIED || ++ avctx->color_trc != AVCOL_TRC_UNSPECIFIED || ++ avctx->colorspace != AVCOL_SPC_UNSPECIFIED), ++ .color_range = avctx->color_range == AVCOL_RANGE_JPEG, ++ .subsampling_x = desc->log2_chroma_w, ++ .subsampling_y = desc->log2_chroma_h, ++ }; ++ ++ switch (avctx->chroma_sample_location) { ++ case AVCHROMA_LOC_LEFT: ++ sh->color_config.chroma_sample_position = AV1_CSP_VERTICAL; ++ break; ++ case AVCHROMA_LOC_TOPLEFT: ++ sh->color_config.chroma_sample_position = AV1_CSP_COLOCATED; ++ break; ++ default: ++ sh->color_config.chroma_sample_position = AV1_CSP_UNKNOWN; ++ break; ++ } ++ ++ if (avctx->level != FF_PROFILE_UNKNOWN) { ++ sh->seq_level_idx[0] = avctx->level; ++ } else { ++ const AV1LevelDescriptor *level; ++ float framerate; ++ ++ if (avctx->framerate.num > 0 && avctx->framerate.den > 0) ++ framerate = avctx->framerate.num / avctx->framerate.den; ++ else ++ framerate = 0; ++ ++ level = ff_av1_guess_level(avctx->bit_rate, priv->tier, ++ ctx->surface_width, ctx->surface_height, ++ priv->tile_rows * priv->tile_cols, ++ priv->tile_cols, framerate); ++ if (level) { ++ av_log(avctx, AV_LOG_VERBOSE, "Using level %s.\n", level->name); ++ sh->seq_level_idx[0] = level->level_idx; ++ } else { ++ av_log(avctx, AV_LOG_VERBOSE, "Stream will not conform to " ++ "any normal level, using maximum parameters level by default.\n"); ++ sh->seq_level_idx[0] = 31; ++ sh->seq_tier[0] = 1; ++ } ++ } ++ vseq->seq_profile = sh->seq_profile; ++ vseq->seq_level_idx = sh->seq_level_idx[0]; ++ vseq->seq_tier = sh->seq_tier[0]; ++ vseq->order_hint_bits_minus_1 = sh->order_hint_bits_minus_1; ++ vseq->intra_period = ctx->gop_size; ++ vseq->ip_period = ctx->b_per_p + 1; ++ ++ vseq->seq_fields.bits.enable_order_hint = sh->enable_order_hint; ++ ++ if (!(ctx->va_rc_mode & VA_RC_CQP)) { ++ vseq->bits_per_second = ctx->va_bit_rate; ++ vseq->seq_fields.bits.enable_cdef = sh->enable_cdef = 1; ++ } ++ ++ ret = vaapi_encode_av1_add_obu(avctx, obu, AV1_OBU_SEQUENCE_HEADER, &priv->sh); ++ if (ret < 0) ++ goto end; ++ ++ ret = vaapi_encode_av1_write_obu(avctx, priv->sh_data, &priv->sh_data_len, obu); ++ if (ret < 0) ++ goto end; ++ ++end: ++ ff_cbs_fragment_reset(obu); ++ return ret; ++} ++ ++static int vaapi_encode_av1_init_picture_params(AVCodecContext *avctx, ++ VAAPIEncodePicture *pic) ++{ ++ VAAPIEncodeContext *ctx = avctx->priv_data; ++ VAAPIEncodeAV1Context *priv = avctx->priv_data; ++ VAAPIEncodeAV1Picture *hpic = pic->priv_data; ++ AV1RawOBU *fh_obu = &priv->fh; ++ AV1RawFrameHeader *fh = &fh_obu->obu.frame.header; ++ VAEncPictureParameterBufferAV1 *vpic = pic->codec_picture_params; ++ CodedBitstreamFragment *obu = &priv->current_obu; ++ VAAPIEncodePicture *ref; ++ VAAPIEncodeAV1Picture *href; ++ int slot, i; ++ int ret; ++ static const int8_t default_loop_filter_ref_deltas[AV1_TOTAL_REFS_PER_FRAME] = ++ { 1, 0, 0, 0, -1, 0, -1, -1 }; ++ ++ memset(fh_obu, 0, sizeof(*fh_obu)); ++ pic->nb_slices = priv->tile_groups; ++ pic->non_independent_frame = pic->encode_order < pic->display_order; ++ fh_obu->header.obu_type = AV1_OBU_FRAME_HEADER; ++ fh_obu->header.obu_has_size_field = 1; ++ ++ switch (pic->type) { ++ case PICTURE_TYPE_IDR: ++ av_assert0(pic->nb_refs[0] == 0 || pic->nb_refs[1]); ++ fh->frame_type = AV1_FRAME_KEY; ++ fh->refresh_frame_flags = 0xFF; ++ fh->base_q_idx = priv->q_idx_idr; ++ hpic->slot = 0; ++ hpic->last_idr_frame = pic->display_order; ++ break; ++ case PICTURE_TYPE_P: ++ av_assert0(pic->nb_refs[0]); ++ fh->frame_type = AV1_FRAME_INTER; ++ fh->base_q_idx = priv->q_idx_p; ++ ref = pic->refs[0][pic->nb_refs[0] - 1]; ++ href = ref->priv_data; ++ hpic->slot = !href->slot; ++ hpic->last_idr_frame = href->last_idr_frame; ++ fh->refresh_frame_flags = 1 << hpic->slot; ++ ++ /** set the nearest frame in L0 as all reference frame. */ ++ for (i = 0; i < AV1_REFS_PER_FRAME; i++) { ++ fh->ref_frame_idx[i] = href->slot; ++ } ++ fh->primary_ref_frame = href->slot; ++ fh->ref_order_hint[href->slot] = ref->display_order - href->last_idr_frame; ++ vpic->ref_frame_ctrl_l0.fields.search_idx0 = AV1_REF_FRAME_LAST; ++ ++ /** set the 2nd nearest frame in L0 as Golden frame. */ ++ if (pic->nb_refs[0] > 1) { ++ ref = pic->refs[0][pic->nb_refs[0] - 2]; ++ href = ref->priv_data; ++ fh->ref_frame_idx[3] = href->slot; ++ fh->ref_order_hint[href->slot] = ref->display_order - href->last_idr_frame; ++ vpic->ref_frame_ctrl_l0.fields.search_idx1 = AV1_REF_FRAME_GOLDEN; ++ } ++ break; ++ case PICTURE_TYPE_B: ++ av_assert0(pic->nb_refs[0] && pic->nb_refs[1]); ++ fh->frame_type = AV1_FRAME_INTER; ++ fh->base_q_idx = priv->q_idx_b; ++ fh->refresh_frame_flags = 0x0; ++ fh->reference_select = 1; ++ ++ /** B frame will not be referenced, disable its recon frame. */ ++ vpic->picture_flags.bits.disable_frame_recon = 1; ++ ++ /** Use LAST_FRAME and BWDREF_FRAME for reference. */ ++ vpic->ref_frame_ctrl_l0.fields.search_idx0 = AV1_REF_FRAME_LAST; ++ vpic->ref_frame_ctrl_l1.fields.search_idx0 = AV1_REF_FRAME_BWDREF; ++ ++ ref = pic->refs[0][pic->nb_refs[0] - 1]; ++ href = ref->priv_data; ++ hpic->last_idr_frame = href->last_idr_frame; ++ fh->primary_ref_frame = href->slot; ++ fh->ref_order_hint[href->slot] = ref->display_order - href->last_idr_frame; ++ for (i = 0; i < AV1_REF_FRAME_GOLDEN; i++) { ++ fh->ref_frame_idx[i] = href->slot; ++ } ++ ++ ref = pic->refs[1][pic->nb_refs[1] - 1]; ++ href = ref->priv_data; ++ fh->ref_order_hint[href->slot] = ref->display_order - href->last_idr_frame; ++ for (i = AV1_REF_FRAME_GOLDEN; i < AV1_REFS_PER_FRAME; i++) { ++ fh->ref_frame_idx[i] = href->slot; ++ } ++ break; ++ default: ++ av_assert0(0 && "invalid picture type"); ++ } ++ ++ fh->show_frame = pic->display_order <= pic->encode_order; ++ fh->showable_frame = fh->frame_type != AV1_FRAME_KEY; ++ fh->frame_width_minus_1 = avctx->width - 1; ++ fh->frame_height_minus_1 = avctx->height - 1; ++ fh->render_width_minus_1 = fh->frame_width_minus_1; ++ fh->render_height_minus_1 = fh->frame_height_minus_1; ++ fh->order_hint = pic->display_order - hpic->last_idr_frame; ++ fh->tile_cols = priv->tile_cols; ++ fh->tile_rows = priv->tile_rows; ++ fh->tile_cols_log2 = priv->tile_cols_log2; ++ fh->tile_rows_log2 = priv->tile_rows_log2; ++ fh->uniform_tile_spacing_flag = priv->uniform_tile; ++ fh->tile_size_bytes_minus1 = priv->attr_ext2.bits.tile_size_bytes_minus1; ++ ++ /** ignore ONLY_4x4 mode for codedlossless is not fully implemented. */ ++ if (priv->attr_ext2.bits.tx_mode_support & 0x04) ++ fh->tx_mode = AV1_TX_MODE_SELECT; ++ else if (priv->attr_ext2.bits.tx_mode_support & 0x02) ++ fh->tx_mode = AV1_TX_MODE_LARGEST; ++ else { ++ av_log(avctx, AV_LOG_ERROR, "No available tx mode found.\n"); ++ return AVERROR(EINVAL); ++ } ++ ++ for (i = 0; i < fh->tile_cols; i++) ++ fh->width_in_sbs_minus_1[i] = vpic->width_in_sbs_minus_1[i] = priv->width_in_sbs_minus_1[i]; ++ ++ for (i = 0; i < fh->tile_rows; i++) ++ fh->height_in_sbs_minus_1[i] = vpic->height_in_sbs_minus_1[i] = priv->height_in_sbs_minus_1[i]; ++ ++ memcpy(fh->loop_filter_ref_deltas, default_loop_filter_ref_deltas, ++ AV1_TOTAL_REFS_PER_FRAME * sizeof(int8_t)); ++ ++ if (fh->frame_type == AV1_FRAME_KEY && fh->show_frame) { ++ fh->error_resilient_mode = 1; ++ } ++ ++ if (fh->frame_type == AV1_FRAME_KEY || fh->error_resilient_mode) ++ fh->primary_ref_frame = AV1_PRIMARY_REF_NONE; ++ ++ vpic->base_qindex = fh->base_q_idx; ++ vpic->frame_width_minus_1 = fh->frame_width_minus_1; ++ vpic->frame_height_minus_1 = fh->frame_height_minus_1; ++ vpic->primary_ref_frame = fh->primary_ref_frame; ++ vpic->reconstructed_frame = pic->recon_surface; ++ vpic->coded_buf = pic->output_buffer; ++ vpic->tile_cols = fh->tile_cols; ++ vpic->tile_rows = fh->tile_rows; ++ vpic->order_hint = fh->order_hint; ++#if VA_CHECK_VERSION(1, 15, 0) ++ vpic->refresh_frame_flags = fh->refresh_frame_flags; ++#endif ++ ++ vpic->picture_flags.bits.enable_frame_obu = 0; ++ vpic->picture_flags.bits.frame_type = fh->frame_type; ++ vpic->picture_flags.bits.reduced_tx_set = fh->reduced_tx_set; ++ vpic->picture_flags.bits.error_resilient_mode = fh->error_resilient_mode; ++ ++ /** let driver decide to use single or compound reference prediction mode. */ ++ vpic->mode_control_flags.bits.reference_mode = fh->reference_select ? 2 : 0; ++ vpic->mode_control_flags.bits.tx_mode = fh->tx_mode; ++ ++ vpic->tile_group_obu_hdr_info.bits.obu_has_size_field = 1; ++ ++ /** set reference. */ ++ for (i = 0; i < AV1_REFS_PER_FRAME; i++) ++ vpic->ref_frame_idx[i] = fh->ref_frame_idx[i]; ++ ++ for (i = 0; i < FF_ARRAY_ELEMS(vpic->reference_frames); i++) ++ vpic->reference_frames[i] = VA_INVALID_SURFACE; ++ ++ for (i = 0; i < MAX_REFERENCE_LIST_NUM; i++) { ++ for (int j = 0; j < pic->nb_refs[i]; j++) { ++ VAAPIEncodePicture *ref_pic = pic->refs[i][j]; ++ ++ slot = ((VAAPIEncodeAV1Picture*)ref_pic->priv_data)->slot; ++ av_assert0(vpic->reference_frames[slot] == VA_INVALID_SURFACE); ++ ++ vpic->reference_frames[slot] = ref_pic->recon_surface; ++ } ++ } ++ ++ fh_obu->obu_size_byte_len = priv->attr_ext2.bits.obu_size_bytes_minus1 + 1; ++ ret = vaapi_encode_av1_add_obu(avctx, obu, AV1_OBU_FRAME_HEADER, &priv->fh); ++ if (ret < 0) ++ goto end; ++ ++ ret = vaapi_encode_av1_write_obu(avctx, priv->fh_data, &priv->fh_data_len, obu); ++ if (ret < 0) ++ goto end; ++ ++ if (!(ctx->va_rc_mode & VA_RC_CQP)) { ++ vpic->min_base_qindex = av_clip(avctx->qmin, 1, AV1_MAX_QUANT); ++ vpic->max_base_qindex = av_clip(avctx->qmax, 1, AV1_MAX_QUANT); ++ ++ vpic->bit_offset_qindex = priv->qindex_offset; ++ vpic->bit_offset_loopfilter_params = priv->loopfilter_offset; ++ vpic->bit_offset_cdef_params = priv->cdef_start_offset; ++ vpic->size_in_bits_cdef_params = priv->cdef_param_size; ++ vpic->size_in_bits_frame_hdr_obu = priv->fh_data_len; ++ vpic->byte_offset_frame_hdr_obu_size = (((pic->type == PICTURE_TYPE_IDR) ? ++ priv->sh_data_len / 8 : 0) + ++ (fh_obu->header.obu_extension_flag ? ++ 2 : 1)); ++ } ++ ++end: ++ ff_cbs_fragment_reset(obu); ++ return ret; ++} ++ ++static int vaapi_encode_av1_init_slice_params(AVCodecContext *avctx, ++ VAAPIEncodePicture *pic, ++ VAAPIEncodeSlice *slice) ++{ ++ VAAPIEncodeAV1Context *priv = avctx->priv_data; ++ VAEncTileGroupBufferAV1 *vslice = slice->codec_slice_params; ++ CodedBitstreamAV1Context *cbctx = priv->cbc->priv_data; ++ int div; ++ ++ /** Set tile group info. */ ++ div = priv->tile_cols * priv->tile_rows / priv->tile_groups; ++ vslice->tg_start = slice->index * div; ++ if (slice->index == (priv->tile_groups - 1)) { ++ vslice->tg_end = priv->tile_cols * priv->tile_rows - 1; ++ cbctx->seen_frame_header = 0; ++ } else { ++ vslice->tg_end = (slice->index + 1) * div - 1; ++ } ++ ++ return 0; ++} ++ ++static int vaapi_encode_av1_write_picture_header(AVCodecContext *avctx, ++ VAAPIEncodePicture *pic, ++ char *data, size_t *data_len) ++{ ++ VAAPIEncodeAV1Context *priv = avctx->priv_data; ++ CodedBitstreamFragment *obu = &priv->current_obu; ++ CodedBitstreamAV1Context *cbctx = priv->cbc->priv_data; ++ AV1RawOBU *fh_obu = &priv->fh; ++ AV1RawFrameHeader *rep_fh = &fh_obu->obu.frame_header; ++ VAAPIEncodeAV1Picture *href; ++ int ret = 0; ++ ++ pic->tail_size = 0; ++ /** Pack repeat frame header. */ ++ if (pic->display_order > pic->encode_order) { ++ memset(fh_obu, 0, sizeof(*fh_obu)); ++ href = pic->refs[0][pic->nb_refs[0] - 1]->priv_data; ++ fh_obu->header.obu_type = AV1_OBU_FRAME_HEADER; ++ fh_obu->header.obu_has_size_field = 1; ++ ++ rep_fh->show_existing_frame = 1; ++ rep_fh->frame_to_show_map_idx = href->slot == 0; ++ rep_fh->frame_type = AV1_FRAME_INTER; ++ rep_fh->frame_width_minus_1 = avctx->width - 1; ++ rep_fh->frame_height_minus_1 = avctx->height - 1; ++ rep_fh->render_width_minus_1 = rep_fh->frame_width_minus_1; ++ rep_fh->render_height_minus_1 = rep_fh->frame_height_minus_1; ++ ++ cbctx->seen_frame_header = 0; ++ ++ ret = vaapi_encode_av1_add_obu(avctx, obu, AV1_OBU_FRAME_HEADER, &priv->fh); ++ if (ret < 0) ++ goto end; ++ ++ ret = vaapi_encode_av1_write_obu(avctx, pic->tail_data, &pic->tail_size, obu); ++ if (ret < 0) ++ goto end; ++ ++ pic->tail_size /= 8; ++ } ++ ++ memcpy(data, &priv->fh_data, MAX_PARAM_BUFFER_SIZE * sizeof(char)); ++ *data_len = priv->fh_data_len; ++ ++end: ++ ff_cbs_fragment_reset(obu); ++ return ret; ++} ++ ++static const VAAPIEncodeProfile vaapi_encode_av1_profiles[] = { ++ { FF_PROFILE_AV1_MAIN, 8, 3, 1, 1, VAProfileAV1Profile0 }, ++ { FF_PROFILE_AV1_MAIN, 10, 3, 1, 1, VAProfileAV1Profile0 }, ++ { FF_PROFILE_UNKNOWN } ++}; ++ ++static const VAAPIEncodeType vaapi_encode_type_av1 = { ++ .profiles = vaapi_encode_av1_profiles, ++ .flags = FLAG_B_PICTURES | FLAG_TIMESTAMP_NO_DELAY, ++ .default_quality = 25, ++ ++ .get_encoder_caps = &vaapi_encode_av1_get_encoder_caps, ++ .configure = &vaapi_encode_av1_configure, ++ ++ .sequence_header_type = VAEncPackedHeaderSequence, ++ .sequence_params_size = sizeof(VAEncSequenceParameterBufferAV1), ++ .init_sequence_params = &vaapi_encode_av1_init_sequence_params, ++ .write_sequence_header = &vaapi_encode_av1_write_sequence_header, ++ ++ .picture_priv_data_size = sizeof(VAAPIEncodeAV1Picture), ++ .picture_header_type = VAEncPackedHeaderPicture, ++ .picture_params_size = sizeof(VAEncPictureParameterBufferAV1), ++ .init_picture_params = &vaapi_encode_av1_init_picture_params, ++ .write_picture_header = &vaapi_encode_av1_write_picture_header, ++ ++ .slice_params_size = sizeof(VAEncTileGroupBufferAV1), ++ .init_slice_params = &vaapi_encode_av1_init_slice_params, ++}; ++ ++static av_cold int vaapi_encode_av1_init(AVCodecContext *avctx) ++{ ++ VAAPIEncodeContext *ctx = avctx->priv_data; ++ VAAPIEncodeAV1Context *priv = avctx->priv_data; ++ VAConfigAttrib attr; ++ VAStatus vas; ++ int ret; ++ ++ ctx->codec = &vaapi_encode_type_av1; ++ ++ ctx->desired_packed_headers = ++ VA_ENC_PACKED_HEADER_SEQUENCE | ++ VA_ENC_PACKED_HEADER_PICTURE; ++ ++ if (avctx->profile == FF_PROFILE_UNKNOWN) ++ avctx->profile = priv->profile; ++ if (avctx->level == FF_PROFILE_UNKNOWN) ++ avctx->level = priv->level; ++ ++ if (avctx->level != FF_PROFILE_UNKNOWN && avctx->level & ~0x1f) { ++ av_log(avctx, AV_LOG_ERROR, "Invalid level %d\n", avctx->level); ++ return AVERROR(EINVAL); ++ } ++ ++ ret = ff_vaapi_encode_init(avctx); ++ if (ret < 0) ++ return ret; ++ ++ attr.type = VAConfigAttribEncAV1; ++ vas = vaGetConfigAttributes(ctx->hwctx->display, ++ ctx->va_profile, ++ ctx->va_entrypoint, ++ &attr, 1); ++ if (vas != VA_STATUS_SUCCESS) { ++ av_log(avctx, AV_LOG_ERROR, "Failed to query " ++ "config attribute: %d (%s).\n", vas, vaErrorStr(vas)); ++ return AVERROR_EXTERNAL; ++ } else if (attr.value == VA_ATTRIB_NOT_SUPPORTED) { ++ priv->attr.value = 0; ++ av_log(avctx, AV_LOG_WARNING, "Attribute type:%d is not " ++ "supported.\n", attr.type); ++ } else { ++ priv->attr.value = attr.value; ++ } ++ ++ attr.type = VAConfigAttribEncAV1Ext1; ++ vas = vaGetConfigAttributes(ctx->hwctx->display, ++ ctx->va_profile, ++ ctx->va_entrypoint, ++ &attr, 1); ++ if (vas != VA_STATUS_SUCCESS) { ++ av_log(avctx, AV_LOG_ERROR, "Failed to query " ++ "config attribute: %d (%s).\n", vas, vaErrorStr(vas)); ++ return AVERROR_EXTERNAL; ++ } else if (attr.value == VA_ATTRIB_NOT_SUPPORTED) { ++ priv->attr_ext1.value = 0; ++ av_log(avctx, AV_LOG_WARNING, "Attribute type:%d is not " ++ "supported.\n", attr.type); ++ } else { ++ priv->attr_ext1.value = attr.value; ++ } ++ ++ /** This attr provides essential indicators, return error if not support. */ ++ attr.type = VAConfigAttribEncAV1Ext2; ++ vas = vaGetConfigAttributes(ctx->hwctx->display, ++ ctx->va_profile, ++ ctx->va_entrypoint, ++ &attr, 1); ++ if (vas != VA_STATUS_SUCCESS || attr.value == VA_ATTRIB_NOT_SUPPORTED) { ++ av_log(avctx, AV_LOG_ERROR, "Failed to query " ++ "config attribute: %d (%s).\n", vas, vaErrorStr(vas)); ++ return AVERROR_EXTERNAL; ++ } else { ++ priv->attr_ext2.value = attr.value; ++ } ++ ++ ret = vaapi_encode_av1_set_tile(avctx); ++ if (ret < 0) ++ return ret; ++ ++ return 0; ++} ++ ++static av_cold int vaapi_encode_av1_close(AVCodecContext *avctx) ++{ ++ VAAPIEncodeAV1Context *priv = avctx->priv_data; ++ ++ ff_cbs_fragment_free(&priv->current_obu); ++ ff_cbs_close(&priv->cbc); ++ ++ return ff_vaapi_encode_close(avctx); ++} ++ ++#define OFFSET(x) offsetof(VAAPIEncodeAV1Context, x) ++#define FLAGS (AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM) ++ ++static const AVOption vaapi_encode_av1_options[] = { ++ VAAPI_ENCODE_COMMON_OPTIONS, ++ VAAPI_ENCODE_RC_OPTIONS, ++ { "profile", "Set profile (seq_profile)", ++ OFFSET(profile), AV_OPT_TYPE_INT, ++ { .i64 = FF_PROFILE_UNKNOWN }, FF_PROFILE_UNKNOWN, 0xff, FLAGS, "profile" }, ++ ++#define PROFILE(name, value) name, NULL, 0, AV_OPT_TYPE_CONST, \ ++ { .i64 = value }, 0, 0, FLAGS, "profile" ++ { PROFILE("main", FF_PROFILE_AV1_MAIN) }, ++ { PROFILE("high", FF_PROFILE_AV1_HIGH) }, ++ { PROFILE("professional", FF_PROFILE_AV1_PROFESSIONAL) }, ++#undef PROFILE ++ ++ { "tier", "Set tier (seq_tier)", ++ OFFSET(tier), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, FLAGS, "tier" }, ++ { "main", NULL, 0, AV_OPT_TYPE_CONST, ++ { .i64 = 0 }, 0, 0, FLAGS, "tier" }, ++ { "high", NULL, 0, AV_OPT_TYPE_CONST, ++ { .i64 = 1 }, 0, 0, FLAGS, "tier" }, ++ { "level", "Set level (seq_level_idx)", ++ OFFSET(level), AV_OPT_TYPE_INT, ++ { .i64 = FF_PROFILE_UNKNOWN }, FF_PROFILE_UNKNOWN, 0x1f, FLAGS, "level" }, ++ ++#define LEVEL(name, value) name, NULL, 0, AV_OPT_TYPE_CONST, \ ++ { .i64 = value }, 0, 0, FLAGS, "level" ++ { LEVEL("2.0", 0) }, ++ { LEVEL("2.1", 1) }, ++ { LEVEL("3.0", 4) }, ++ { LEVEL("3.1", 5) }, ++ { LEVEL("4.0", 8) }, ++ { LEVEL("4.1", 9) }, ++ { LEVEL("5.0", 12) }, ++ { LEVEL("5.1", 13) }, ++ { LEVEL("5.2", 14) }, ++ { LEVEL("5.3", 15) }, ++ { LEVEL("6.0", 16) }, ++ { LEVEL("6.1", 17) }, ++ { LEVEL("6.2", 18) }, ++ { LEVEL("6.3", 19) }, ++#undef LEVEL ++ ++ { "tiles", "Tile columns x rows (Use minimal tile column/row number automatically by default)", ++ OFFSET(tile_cols), AV_OPT_TYPE_IMAGE_SIZE, { .str = NULL }, 0, 0, FLAGS }, ++ { "tile_groups", "Number of tile groups for encoding", ++ OFFSET(tile_groups), AV_OPT_TYPE_INT, { .i64 = 1 }, 1, AV1_MAX_TILE_ROWS * AV1_MAX_TILE_COLS, FLAGS }, ++ ++ { NULL }, ++}; ++ ++static const FFCodecDefault vaapi_encode_av1_defaults[] = { ++ { "b", "0" }, ++ { "bf", "2" }, ++ { "g", "120" }, ++ { "qmin", "1" }, ++ { "qmax", "255" }, ++ { NULL }, ++}; ++ ++static const AVClass vaapi_encode_av1_class = { ++ .class_name = "av1_vaapi", ++ .item_name = av_default_item_name, ++ .option = vaapi_encode_av1_options, ++ .version = LIBAVUTIL_VERSION_INT, ++}; ++ ++const FFCodec ff_av1_vaapi_encoder = { ++ .p.name = "av1_vaapi", ++ CODEC_LONG_NAME("AV1 (VAAPI)"), ++ .p.type = AVMEDIA_TYPE_VIDEO, ++ .p.id = AV_CODEC_ID_AV1, ++ .priv_data_size = sizeof(VAAPIEncodeAV1Context), ++ .init = &vaapi_encode_av1_init, ++ FF_CODEC_RECEIVE_PACKET_CB(&ff_vaapi_encode_receive_packet), ++ .close = &vaapi_encode_av1_close, ++ .p.priv_class = &vaapi_encode_av1_class, ++ .p.capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_HARDWARE | ++ AV_CODEC_CAP_DR1 | AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE, ++ .caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE | ++ FF_CODEC_CAP_INIT_CLEANUP, ++ .defaults = vaapi_encode_av1_defaults, ++ .p.pix_fmts = (const enum AVPixelFormat[]) { ++ AV_PIX_FMT_VAAPI, ++ AV_PIX_FMT_NONE, ++ }, ++ .hw_configs = ff_vaapi_encode_hw_configs, ++ .p.wrapper_name = "vaapi", ++}; +diff --git a/libavcodec/vaapi_encode_h264.c b/libavcodec/vaapi_encode_h264.c +index 645f6a9..c205d1e 100644 +--- a/libavcodec/vaapi_encode_h264.c ++++ b/libavcodec/vaapi_encode_h264.c +@@ -614,7 +614,7 @@ static int vaapi_encode_h264_init_picture_params(AVCodecContext *avctx, + VAAPIEncodePicture *prev = pic->prev; + VAAPIEncodeH264Picture *hprev = prev ? prev->priv_data : NULL; + VAEncPictureParameterBufferH264 *vpic = pic->codec_picture_params; +- int i; ++ int i, j = 0; + + if (pic->type == PICTURE_TYPE_IDR) { + av_assert0(pic->display_order == pic->encode_order); +@@ -715,24 +715,26 @@ static int vaapi_encode_h264_init_picture_params(AVCodecContext *avctx, + .TopFieldOrderCnt = hpic->pic_order_cnt, + .BottomFieldOrderCnt = hpic->pic_order_cnt, + }; +- +- for (i = 0; i < pic->nb_refs; i++) { +- VAAPIEncodePicture *ref = pic->refs[i]; +- VAAPIEncodeH264Picture *href; +- +- av_assert0(ref && ref->encode_order < pic->encode_order); +- href = ref->priv_data; +- +- vpic->ReferenceFrames[i] = (VAPictureH264) { +- .picture_id = ref->recon_surface, +- .frame_idx = href->frame_num, +- .flags = VA_PICTURE_H264_SHORT_TERM_REFERENCE, +- .TopFieldOrderCnt = href->pic_order_cnt, +- .BottomFieldOrderCnt = href->pic_order_cnt, +- }; ++ for (int k = 0; k < MAX_REFERENCE_LIST_NUM; k++) { ++ for (i = 0; i < pic->nb_refs[k]; i++) { ++ VAAPIEncodePicture *ref = pic->refs[k][i]; ++ VAAPIEncodeH264Picture *href; ++ ++ av_assert0(ref && ref->encode_order < pic->encode_order); ++ href = ref->priv_data; ++ ++ vpic->ReferenceFrames[j++] = (VAPictureH264) { ++ .picture_id = ref->recon_surface, ++ .frame_idx = href->frame_num, ++ .flags = VA_PICTURE_H264_SHORT_TERM_REFERENCE, ++ .TopFieldOrderCnt = href->pic_order_cnt, ++ .BottomFieldOrderCnt = href->pic_order_cnt, ++ }; ++ } + } +- for (; i < FF_ARRAY_ELEMS(vpic->ReferenceFrames); i++) { +- vpic->ReferenceFrames[i] = (VAPictureH264) { ++ ++ for (; j < FF_ARRAY_ELEMS(vpic->ReferenceFrames); j++) { ++ vpic->ReferenceFrames[j] = (VAPictureH264) { + .picture_id = VA_INVALID_ID, + .flags = VA_PICTURE_H264_INVALID, + }; +@@ -934,17 +936,17 @@ static int vaapi_encode_h264_init_slice_params(AVCodecContext *avctx, + + if (pic->type == PICTURE_TYPE_P) { + int need_rplm = 0; +- for (i = 0; i < pic->nb_refs; i++) { +- av_assert0(pic->refs[i]); +- if (pic->refs[i] != def_l0[i]) ++ for (i = 0; i < pic->nb_refs[0]; i++) { ++ av_assert0(pic->refs[0][i]); ++ if (pic->refs[0][i] != def_l0[i]) + need_rplm = 1; + } + + sh->ref_pic_list_modification_flag_l0 = need_rplm; + if (need_rplm) { + int pic_num = hpic->frame_num; +- for (i = 0; i < pic->nb_refs; i++) { +- href = pic->refs[i]->priv_data; ++ for (i = 0; i < pic->nb_refs[0]; i++) { ++ href = pic->refs[0][i]->priv_data; + av_assert0(href->frame_num != pic_num); + if (href->frame_num < pic_num) { + sh->rplm_l0[i].modification_of_pic_nums_idc = 0; +@@ -963,28 +965,29 @@ static int vaapi_encode_h264_init_slice_params(AVCodecContext *avctx, + } else { + int need_rplm_l0 = 0, need_rplm_l1 = 0; + int n0 = 0, n1 = 0; +- for (i = 0; i < pic->nb_refs; i++) { +- av_assert0(pic->refs[i]); +- href = pic->refs[i]->priv_data; +- av_assert0(href->pic_order_cnt != hpic->pic_order_cnt); +- if (href->pic_order_cnt < hpic->pic_order_cnt) { +- if (pic->refs[i] != def_l0[n0]) +- need_rplm_l0 = 1; +- ++n0; +- } else { +- if (pic->refs[i] != def_l1[n1]) +- need_rplm_l1 = 1; +- ++n1; +- } ++ for (i = 0; i < pic->nb_refs[0]; i++) { ++ av_assert0(pic->refs[0][i]); ++ href = pic->refs[0][i]->priv_data; ++ av_assert0(href->pic_order_cnt < hpic->pic_order_cnt); ++ if (pic->refs[0][i] != def_l0[n0]) ++ need_rplm_l0 = 1; ++ ++n0; ++ } ++ ++ for (i = 0; i < pic->nb_refs[1]; i++) { ++ av_assert0(pic->refs[1][i]); ++ href = pic->refs[1][i]->priv_data; ++ av_assert0(href->pic_order_cnt > hpic->pic_order_cnt); ++ if (pic->refs[1][i] != def_l1[n1]) ++ need_rplm_l1 = 1; ++ ++n1; + } + + sh->ref_pic_list_modification_flag_l0 = need_rplm_l0; + if (need_rplm_l0) { + int pic_num = hpic->frame_num; +- for (i = j = 0; i < pic->nb_refs; i++) { +- href = pic->refs[i]->priv_data; +- if (href->pic_order_cnt > hpic->pic_order_cnt) +- continue; ++ for (i = j = 0; i < pic->nb_refs[0]; i++) { ++ href = pic->refs[0][i]->priv_data; + av_assert0(href->frame_num != pic_num); + if (href->frame_num < pic_num) { + sh->rplm_l0[j].modification_of_pic_nums_idc = 0; +@@ -1005,10 +1008,8 @@ static int vaapi_encode_h264_init_slice_params(AVCodecContext *avctx, + sh->ref_pic_list_modification_flag_l1 = need_rplm_l1; + if (need_rplm_l1) { + int pic_num = hpic->frame_num; +- for (i = j = 0; i < pic->nb_refs; i++) { +- href = pic->refs[i]->priv_data; +- if (href->pic_order_cnt < hpic->pic_order_cnt) +- continue; ++ for (i = j = 0; i < pic->nb_refs[1]; i++) { ++ href = pic->refs[1][i]->priv_data; + av_assert0(href->frame_num != pic_num); + if (href->frame_num < pic_num) { + sh->rplm_l1[j].modification_of_pic_nums_idc = 0; +@@ -1048,14 +1049,13 @@ static int vaapi_encode_h264_init_slice_params(AVCodecContext *avctx, + vslice->RefPicList1[i].flags = VA_PICTURE_H264_INVALID; + } + +- av_assert0(pic->nb_refs <= 2); +- if (pic->nb_refs >= 1) { ++ if (pic->nb_refs[0]) { + // Backward reference for P- or B-frame. + av_assert0(pic->type == PICTURE_TYPE_P || + pic->type == PICTURE_TYPE_B); + vslice->RefPicList0[0] = vpic->ReferenceFrames[0]; + } +- if (pic->nb_refs >= 2) { ++ if (pic->nb_refs[1]) { + // Forward reference for B-frame. + av_assert0(pic->type == PICTURE_TYPE_B); + vslice->RefPicList1[0] = vpic->ReferenceFrames[1]; +diff --git a/libavcodec/vaapi_encode_h265.c b/libavcodec/vaapi_encode_h265.c +index aa7e532..f015e6f 100644 +--- a/libavcodec/vaapi_encode_h265.c ++++ b/libavcodec/vaapi_encode_h265.c +@@ -764,7 +764,7 @@ static int vaapi_encode_h265_init_picture_params(AVCodecContext *avctx, + VAAPIEncodePicture *prev = pic->prev; + VAAPIEncodeH265Picture *hprev = prev ? prev->priv_data : NULL; + VAEncPictureParameterBufferHEVC *vpic = pic->codec_picture_params; +- int i; ++ int i, j = 0; + + if (pic->type == PICTURE_TYPE_IDR) { + av_assert0(pic->display_order == pic->encode_order); +@@ -789,8 +789,8 @@ static int vaapi_encode_h265_init_picture_params(AVCodecContext *avctx, + hpic->pic_type = 1; + } else { + VAAPIEncodePicture *irap_ref; +- av_assert0(pic->refs[0] && pic->refs[1]); +- for (irap_ref = pic; irap_ref; irap_ref = irap_ref->refs[1]) { ++ av_assert0(pic->refs[0][0] && pic->refs[1][0]); ++ for (irap_ref = pic; irap_ref; irap_ref = irap_ref->refs[1][0]) { + if (irap_ref->type == PICTURE_TYPE_I) + break; + } +@@ -915,24 +915,27 @@ static int vaapi_encode_h265_init_picture_params(AVCodecContext *avctx, + .flags = 0, + }; + +- for (i = 0; i < pic->nb_refs; i++) { +- VAAPIEncodePicture *ref = pic->refs[i]; +- VAAPIEncodeH265Picture *href; +- +- av_assert0(ref && ref->encode_order < pic->encode_order); +- href = ref->priv_data; +- +- vpic->reference_frames[i] = (VAPictureHEVC) { +- .picture_id = ref->recon_surface, +- .pic_order_cnt = href->pic_order_cnt, +- .flags = (ref->display_order < pic->display_order ? +- VA_PICTURE_HEVC_RPS_ST_CURR_BEFORE : 0) | +- (ref->display_order > pic->display_order ? +- VA_PICTURE_HEVC_RPS_ST_CURR_AFTER : 0), +- }; ++ for (int k = 0; k < MAX_REFERENCE_LIST_NUM; k++) { ++ for (i = 0; i < pic->nb_refs[k]; i++) { ++ VAAPIEncodePicture *ref = pic->refs[k][i]; ++ VAAPIEncodeH265Picture *href; ++ ++ av_assert0(ref && ref->encode_order < pic->encode_order); ++ href = ref->priv_data; ++ ++ vpic->reference_frames[j++] = (VAPictureHEVC) { ++ .picture_id = ref->recon_surface, ++ .pic_order_cnt = href->pic_order_cnt, ++ .flags = (ref->display_order < pic->display_order ? ++ VA_PICTURE_HEVC_RPS_ST_CURR_BEFORE : 0) | ++ (ref->display_order > pic->display_order ? ++ VA_PICTURE_HEVC_RPS_ST_CURR_AFTER : 0), ++ }; ++ } + } +- for (; i < FF_ARRAY_ELEMS(vpic->reference_frames); i++) { +- vpic->reference_frames[i] = (VAPictureHEVC) { ++ ++ for (; j < FF_ARRAY_ELEMS(vpic->reference_frames); j++) { ++ vpic->reference_frames[j] = (VAPictureHEVC) { + .picture_id = VA_INVALID_ID, + .flags = VA_PICTURE_HEVC_INVALID, + }; +@@ -1016,21 +1019,33 @@ static int vaapi_encode_h265_init_slice_params(AVCodecContext *avctx, + memset(rps, 0, sizeof(*rps)); + + rps_pics = 0; +- for (i = 0; i < pic->nb_refs; i++) { +- strp = pic->refs[i]->priv_data; +- rps_poc[rps_pics] = strp->pic_order_cnt; +- rps_used[rps_pics] = 1; +- ++rps_pics; ++ for (i = 0; i < MAX_REFERENCE_LIST_NUM; i++) { ++ for (j = 0; j < pic->nb_refs[i]; j++) { ++ strp = pic->refs[i][j]->priv_data; ++ rps_poc[rps_pics] = strp->pic_order_cnt; ++ rps_used[rps_pics] = 1; ++ ++rps_pics; ++ } + } ++ + for (i = 0; i < pic->nb_dpb_pics; i++) { + if (pic->dpb[i] == pic) + continue; +- for (j = 0; j < pic->nb_refs; j++) { +- if (pic->dpb[i] == pic->refs[j]) ++ ++ for (j = 0; j < pic->nb_refs[0]; j++) { ++ if (pic->dpb[i] == pic->refs[0][j]) ++ break; ++ } ++ if (j < pic->nb_refs[0]) ++ continue; ++ ++ for (j = 0; j < pic->nb_refs[1]; j++) { ++ if (pic->dpb[i] == pic->refs[1][j]) + break; + } +- if (j < pic->nb_refs) ++ if (j < pic->nb_refs[1]) + continue; ++ + strp = pic->dpb[i]->priv_data; + rps_poc[rps_pics] = strp->pic_order_cnt; + rps_used[rps_pics] = 0; +@@ -1155,8 +1170,7 @@ static int vaapi_encode_h265_init_slice_params(AVCodecContext *avctx, + vslice->ref_pic_list1[i].flags = VA_PICTURE_HEVC_INVALID; + } + +- av_assert0(pic->nb_refs <= 2); +- if (pic->nb_refs >= 1) { ++ if (pic->nb_refs[0]) { + // Backward reference for P- or B-frame. + av_assert0(pic->type == PICTURE_TYPE_P || + pic->type == PICTURE_TYPE_B); +@@ -1165,7 +1179,7 @@ static int vaapi_encode_h265_init_slice_params(AVCodecContext *avctx, + // Reference for GPB B-frame, L0 == L1 + vslice->ref_pic_list1[0] = vpic->reference_frames[0]; + } +- if (pic->nb_refs >= 2) { ++ if (pic->nb_refs[1]) { + // Forward reference for B-frame. + av_assert0(pic->type == PICTURE_TYPE_B); + vslice->ref_pic_list1[0] = vpic->reference_frames[1]; +diff --git a/libavcodec/vaapi_encode_mpeg2.c b/libavcodec/vaapi_encode_mpeg2.c +index 9261d19..8000ae1 100644 +--- a/libavcodec/vaapi_encode_mpeg2.c ++++ b/libavcodec/vaapi_encode_mpeg2.c +@@ -458,12 +458,12 @@ static int vaapi_encode_mpeg2_init_picture_params(AVCodecContext *avctx, + break; + case PICTURE_TYPE_P: + vpic->picture_type = VAEncPictureTypePredictive; +- vpic->forward_reference_picture = pic->refs[0]->recon_surface; ++ vpic->forward_reference_picture = pic->refs[0][0]->recon_surface; + break; + case PICTURE_TYPE_B: + vpic->picture_type = VAEncPictureTypeBidirectional; +- vpic->forward_reference_picture = pic->refs[0]->recon_surface; +- vpic->backward_reference_picture = pic->refs[1]->recon_surface; ++ vpic->forward_reference_picture = pic->refs[0][0]->recon_surface; ++ vpic->backward_reference_picture = pic->refs[1][0]->recon_surface; + break; + default: + av_assert0(0 && "invalid picture type"); +diff --git a/libavcodec/vaapi_encode_vp8.c b/libavcodec/vaapi_encode_vp8.c +index ae6a8d3..b96e4cd 100644 +--- a/libavcodec/vaapi_encode_vp8.c ++++ b/libavcodec/vaapi_encode_vp8.c +@@ -86,7 +86,7 @@ static int vaapi_encode_vp8_init_picture_params(AVCodecContext *avctx, + switch (pic->type) { + case PICTURE_TYPE_IDR: + case PICTURE_TYPE_I: +- av_assert0(pic->nb_refs == 0); ++ av_assert0(pic->nb_refs[0] == 0 && pic->nb_refs[1] == 0); + vpic->ref_flags.bits.force_kf = 1; + vpic->ref_last_frame = + vpic->ref_gf_frame = +@@ -94,14 +94,14 @@ static int vaapi_encode_vp8_init_picture_params(AVCodecContext *avctx, + VA_INVALID_SURFACE; + break; + case PICTURE_TYPE_P: +- av_assert0(pic->nb_refs == 1); ++ av_assert0(!pic->nb_refs[1]); + vpic->ref_flags.bits.no_ref_last = 0; + vpic->ref_flags.bits.no_ref_gf = 1; + vpic->ref_flags.bits.no_ref_arf = 1; + vpic->ref_last_frame = + vpic->ref_gf_frame = + vpic->ref_arf_frame = +- pic->refs[0]->recon_surface; ++ pic->refs[0][0]->recon_surface; + break; + default: + av_assert0(0 && "invalid picture type"); +diff --git a/libavcodec/vaapi_encode_vp9.c b/libavcodec/vaapi_encode_vp9.c +index af1353c..d9e8ba6 100644 +--- a/libavcodec/vaapi_encode_vp9.c ++++ b/libavcodec/vaapi_encode_vp9.c +@@ -96,15 +96,15 @@ static int vaapi_encode_vp9_init_picture_params(AVCodecContext *avctx, + + switch (pic->type) { + case PICTURE_TYPE_IDR: +- av_assert0(pic->nb_refs == 0); ++ av_assert0(pic->nb_refs[0] == 0 && pic->nb_refs[1] == 0); + vpic->ref_flags.bits.force_kf = 1; + vpic->refresh_frame_flags = 0xff; + hpic->slot = 0; + break; + case PICTURE_TYPE_P: +- av_assert0(pic->nb_refs == 1); ++ av_assert0(!pic->nb_refs[1]); + { +- VAAPIEncodeVP9Picture *href = pic->refs[0]->priv_data; ++ VAAPIEncodeVP9Picture *href = pic->refs[0][0]->priv_data; + av_assert0(href->slot == 0 || href->slot == 1); + + if (ctx->max_b_depth > 0) { +@@ -120,10 +120,10 @@ static int vaapi_encode_vp9_init_picture_params(AVCodecContext *avctx, + } + break; + case PICTURE_TYPE_B: +- av_assert0(pic->nb_refs == 2); ++ av_assert0(pic->nb_refs[0] && pic->nb_refs[1]); + { +- VAAPIEncodeVP9Picture *href0 = pic->refs[0]->priv_data, +- *href1 = pic->refs[1]->priv_data; ++ VAAPIEncodeVP9Picture *href0 = pic->refs[0][0]->priv_data, ++ *href1 = pic->refs[1][0]->priv_data; + av_assert0(href0->slot < pic->b_depth + 1 && + href1->slot < pic->b_depth + 1); + +@@ -157,12 +157,14 @@ static int vaapi_encode_vp9_init_picture_params(AVCodecContext *avctx, + for (i = 0; i < FF_ARRAY_ELEMS(vpic->reference_frames); i++) + vpic->reference_frames[i] = VA_INVALID_SURFACE; + +- for (i = 0; i < pic->nb_refs; i++) { +- VAAPIEncodePicture *ref_pic = pic->refs[i]; +- int slot; +- slot = ((VAAPIEncodeVP9Picture*)ref_pic->priv_data)->slot; +- av_assert0(vpic->reference_frames[slot] == VA_INVALID_SURFACE); +- vpic->reference_frames[slot] = ref_pic->recon_surface; ++ for (i = 0; i < MAX_REFERENCE_LIST_NUM; i++) { ++ for (int j = 0; j < pic->nb_refs[i]; j++) { ++ VAAPIEncodePicture *ref_pic = pic->refs[i][j]; ++ int slot; ++ slot = ((VAAPIEncodeVP9Picture*)ref_pic->priv_data)->slot; ++ av_assert0(vpic->reference_frames[slot] == VA_INVALID_SURFACE); ++ vpic->reference_frames[slot] = ref_pic->recon_surface; ++ } + } + + vpic->pic_flags.bits.frame_type = (pic->type != PICTURE_TYPE_IDR); +-- +2.41.0 + diff --git a/ffmpeg.spec b/ffmpeg.spec index 9598d2e..90ebd35 100644 --- a/ffmpeg.spec +++ b/ffmpeg.spec @@ -92,7 +92,7 @@ Name: ffmpeg %global pkg_name %{name}%{?pkg_suffix} Version: 6.0 -Release: 5%{?dist} +Release: 6%{?dist} Summary: A complete solution to record, convert and stream audio and video License: GPL-3.0-or-later URL: https://ffmpeg.org/ @@ -125,6 +125,16 @@ Patch5: 0001-avfilter-vf_libplacebo-remove-deprecated-field.patch # 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 + # Set up dlopen for openh264 Patch1001: ffmpeg-dlopen-openh264.patch @@ -857,6 +867,10 @@ rm -rf %{buildroot}%{_datadir}/%{name}/examples %{_mandir}/man3/libswscale.3* %changelog +* Fri Nov 10 2023 Neal Gompa - 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 - 6.0-5 - Backport upstream patch to fix segfault when passing non-existent filter option (rfbz#6773) From b3cfba90d45ccf7fdd58a4e0fa79e6527890b58d Mon Sep 17 00:00:00 2001 From: Neal Gompa Date: Sat, 11 Nov 2023 09:10:58 -0500 Subject: [PATCH 16/95] 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 From 84a6385f06c09e1624743a9e835bd7e8f90390e3 Mon Sep 17 00:00:00 2001 From: Neal Gompa Date: Sat, 11 Nov 2023 09:10:58 -0500 Subject: [PATCH 17/95] Update to 6.0.1 - Add ffmpeg chromium support patch (#2240127) - Use git to apply patches --- ffmpeg-chromium.patch | 46 +++++++++++++++++++++++++++++++++++++++++++ ffmpeg.spec | 20 +++++++++++++++---- sources | 4 ++-- 3 files changed, 64 insertions(+), 6 deletions(-) create mode 100644 ffmpeg-chromium.patch 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 90ebd35..78d3f5a 100644 --- a/ffmpeg.spec +++ b/ffmpeg.spec @@ -91,8 +91,8 @@ Name: ffmpeg %global pkg_name %{name}%{?pkg_suffix} -Version: 6.0 -Release: 6%{?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/ @@ -138,6 +138,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} @@ -154,6 +160,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 @@ -550,10 +557,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 @@ -867,6 +874,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-6 - 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 From 7207d7985891156a1e4d728fa896670cc767bac0 Mon Sep 17 00:00:00 2001 From: Neal Gompa Date: Sat, 30 Sep 2023 08:09:48 -0400 Subject: [PATCH 18/95] Fix ffmpeg-allow-fdk-aac-free.patch to apply with git-am --- ffmpeg-allow-fdk-aac-free.patch | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ffmpeg-allow-fdk-aac-free.patch b/ffmpeg-allow-fdk-aac-free.patch index 0cc91f1..3b87cce 100644 --- a/ffmpeg-allow-fdk-aac-free.patch +++ b/ffmpeg-allow-fdk-aac-free.patch @@ -1,3 +1,5 @@ +From: Andreas Schneider + fdk-aac-free-devel is GPL compatible See https://bugzilla.redhat.com/show_bug.cgi?id=1501522#c112 From cc897ea5ca8f487ef79d84d3b453b321a8937a03 Mon Sep 17 00:00:00 2001 From: Kalev Lember Date: Wed, 6 Dec 2023 13:18:11 +0100 Subject: [PATCH 19/95] Prefer openh264 over noopenh264 Add "Suggests: openh264" so that dnf picks openh264 over noopenh264 that both provide the same library. --- ffmpeg.spec | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ffmpeg.spec b/ffmpeg.spec index 0ad6eac..f3d86b6 100644 --- a/ffmpeg.spec +++ b/ffmpeg.spec @@ -92,7 +92,7 @@ Name: ffmpeg %global pkg_name %{name}%{?pkg_suffix} Version: 6.0.1 -Release: 1%{?dist} +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/ @@ -352,6 +352,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 @@ -875,6 +876,10 @@ rm -rf %{buildroot}%{_datadir}/%{name}/examples %{_mandir}/man3/libswscale.3* %changelog +* Wed Dec 06 2023 Kalev Lember - 6.0.1-2 +- Build against noopenh264 stub headers and drop the bundled headers +- Prefer openh264 over noopenh264 + * Sat Nov 11 2023 Neal Gompa - 6.0.1-1 - Update to 6.0.1 - Add ffmpeg chromium support patch (#2240127) From 9f0ba814c48a7751994b5ef3404fea80430de99e Mon Sep 17 00:00:00 2001 From: Kalev Lember Date: Fri, 8 Dec 2023 15:16:48 +0100 Subject: [PATCH 20/95] 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. --- ...-Drop-openh264-runtime-version-check.patch | 109 ++++++++++++++++++ ffmpeg-dlopen-openh264.patch | 48 +++----- ffmpeg.spec | 5 + 3 files changed, 128 insertions(+), 34 deletions(-) create mode 100644 0001-lavc-libopenh264-Drop-openh264-runtime-version-check.patch diff --git a/0001-lavc-libopenh264-Drop-openh264-runtime-version-check.patch b/0001-lavc-libopenh264-Drop-openh264-runtime-version-check.patch new file mode 100644 index 0000000..7066f16 --- /dev/null +++ b/0001-lavc-libopenh264-Drop-openh264-runtime-version-check.patch @@ -0,0 +1,109 @@ +From a641e629591d68bd3edd99bddec623dc31295f6b Mon Sep 17 00:00:00 2001 +From: Kalev Lember +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 +--- + 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 + diff --git a/ffmpeg-dlopen-openh264.patch b/ffmpeg-dlopen-openh264.patch index 334e07f..a283f85 100644 --- a/ffmpeg-dlopen-openh264.patch +++ b/ffmpeg-dlopen-openh264.patch @@ -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 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 --- 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 diff --git a/ffmpeg.spec b/ffmpeg.spec index f3d86b6..4ee89e1 100644 --- a/ffmpeg.spec +++ b/ffmpeg.spec @@ -136,6 +136,10 @@ Patch8: FFmpeg-devel-v10-Support-enhanced-flv-in-FFmpeg.patch ## 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 @@ -879,6 +883,7 @@ rm -rf %{buildroot}%{_datadir}/%{name}/examples * Wed Dec 06 2023 Kalev Lember - 6.0.1-2 - Build against noopenh264 stub headers and drop the bundled headers - Prefer openh264 over noopenh264 +- Backport upstream patch to drop openh264 runtime version checks * Sat Nov 11 2023 Neal Gompa - 6.0.1-1 - Update to 6.0.1 From e691a74e2bc0672608b59320de4050ae7ffde966 Mon Sep 17 00:00:00 2001 From: Neal Gompa Date: Fri, 8 Dec 2023 13:06:07 -0500 Subject: [PATCH 21/95] Delete inaccurate changelog entry We haven't done this yet... --- ffmpeg.spec | 1 - 1 file changed, 1 deletion(-) diff --git a/ffmpeg.spec b/ffmpeg.spec index 4ee89e1..0ba795e 100644 --- a/ffmpeg.spec +++ b/ffmpeg.spec @@ -881,7 +881,6 @@ rm -rf %{buildroot}%{_datadir}/%{name}/examples %changelog * Wed Dec 06 2023 Kalev Lember - 6.0.1-2 -- Build against noopenh264 stub headers and drop the bundled headers - Prefer openh264 over noopenh264 - Backport upstream patch to drop openh264 runtime version checks From 73f1d91714624e7ee33e3794b8d55d337851a98f Mon Sep 17 00:00:00 2001 From: Kalev Lember Date: Wed, 6 Dec 2023 13:18:11 +0100 Subject: [PATCH 22/95] Prefer openh264 over noopenh264 Add "Suggests: openh264" so that dnf picks openh264 over noopenh264 that both provide the same library. --- ffmpeg.spec | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ffmpeg.spec b/ffmpeg.spec index 78d3f5a..1ce50c5 100644 --- a/ffmpeg.spec +++ b/ffmpeg.spec @@ -92,7 +92,7 @@ Name: ffmpeg %global pkg_name %{name}%{?pkg_suffix} Version: 6.0.1 -Release: 1%{?dist} +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/ @@ -351,6 +351,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 @@ -874,6 +875,9 @@ rm -rf %{buildroot}%{_datadir}/%{name}/examples %{_mandir}/man3/libswscale.3* %changelog +* Wed Dec 06 2023 Kalev Lember - 6.0.1-2 +- Prefer openh264 over noopenh264 + * Sat Nov 11 2023 Neal Gompa - 6.0.1-1 - Update to 6.0.1 - Add ffmpeg chromium support patch (#2240127) From 187b050f07f1c50bdcd0774fbaa275abd9f5bf79 Mon Sep 17 00:00:00 2001 From: Kalev Lember Date: Fri, 8 Dec 2023 15:16:48 +0100 Subject: [PATCH 23/95] 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. --- ...-Drop-openh264-runtime-version-check.patch | 109 ++++++++++++++++++ ffmpeg-dlopen-openh264.patch | 48 +++----- ffmpeg.spec | 5 + 3 files changed, 128 insertions(+), 34 deletions(-) create mode 100644 0001-lavc-libopenh264-Drop-openh264-runtime-version-check.patch diff --git a/0001-lavc-libopenh264-Drop-openh264-runtime-version-check.patch b/0001-lavc-libopenh264-Drop-openh264-runtime-version-check.patch new file mode 100644 index 0000000..7066f16 --- /dev/null +++ b/0001-lavc-libopenh264-Drop-openh264-runtime-version-check.patch @@ -0,0 +1,109 @@ +From a641e629591d68bd3edd99bddec623dc31295f6b Mon Sep 17 00:00:00 2001 +From: Kalev Lember +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 +--- + 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 + diff --git a/ffmpeg-dlopen-openh264.patch b/ffmpeg-dlopen-openh264.patch index 334e07f..a283f85 100644 --- a/ffmpeg-dlopen-openh264.patch +++ b/ffmpeg-dlopen-openh264.patch @@ -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 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 --- 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 diff --git a/ffmpeg.spec b/ffmpeg.spec index 1ce50c5..e3fd439 100644 --- a/ffmpeg.spec +++ b/ffmpeg.spec @@ -135,6 +135,10 @@ Patch8: FFmpeg-devel-v10-Support-enhanced-flv-in-FFmpeg.patch ## 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 @@ -877,6 +881,7 @@ rm -rf %{buildroot}%{_datadir}/%{name}/examples %changelog * Wed Dec 06 2023 Kalev Lember - 6.0.1-2 - Prefer openh264 over noopenh264 +- Backport upstream patch to drop openh264 runtime version checks * Sat Nov 11 2023 Neal Gompa - 6.0.1-1 - Update to 6.0.1 From 37bbe8c93acc59886c441bae7515a010ebd2cbf6 Mon Sep 17 00:00:00 2001 From: Neal Gompa Date: Thu, 4 Jan 2024 10:48:18 -0500 Subject: [PATCH 24/95] Rebase to 6.1 --- ...f_libplacebo-remove-deprecated-field.patch | 73 - ...lacebo-wrap-deprecated-opts-in-FF_AP.patch | 76 - ...ilter-initialize-the-o-to-silence-th.patch | 30 - ...ild-vulkan-decode-code-if-vulkan_av1.patch | 27 + ...l-v10-Support-enhanced-flv-in-FFmpeg.patch | 1230 ----- ffmpeg-dlopen-openh264.patch | 26 +- ffmpeg-ge-av1-vaapi-encode-support.patch | 3984 ----------------- ffmpeg-new-coder-errors.patch | 37 - ffmpeg.spec | 36 +- ffmpeg_free_sources | 161 +- sources | 4 +- 11 files changed, 142 insertions(+), 5542 deletions(-) delete mode 100644 0001-avfilter-vf_libplacebo-remove-deprecated-field.patch delete mode 100644 0001-avfilter-vf_libplacebo-wrap-deprecated-opts-in-FF_AP.patch delete mode 100644 0001-fftools-ffmpeg_filter-initialize-the-o-to-silence-th.patch create mode 100644 0001-lavc-Makefile-build-vulkan-decode-code-if-vulkan_av1.patch delete mode 100644 FFmpeg-devel-v10-Support-enhanced-flv-in-FFmpeg.patch delete mode 100644 ffmpeg-ge-av1-vaapi-encode-support.patch delete mode 100644 ffmpeg-new-coder-errors.patch diff --git a/0001-avfilter-vf_libplacebo-remove-deprecated-field.patch b/0001-avfilter-vf_libplacebo-remove-deprecated-field.patch deleted file mode 100644 index 0819af4..0000000 --- a/0001-avfilter-vf_libplacebo-remove-deprecated-field.patch +++ /dev/null @@ -1,73 +0,0 @@ -From 1231003c3c6d4839a9e838d06f8e16ee7690958f Mon Sep 17 00:00:00 2001 -From: Niklas Haas -Date: Mon, 13 Mar 2023 14:33:16 +0100 -Subject: [PATCH] avfilter/vf_libplacebo: remove deprecated field - -This has not been functional since a year ago, including in our current -minimum dependency of libplacebo (v4.192.0). It also causes build errors -against libplacebo v6, so it needs to be removed from the code. We can -keep the option around for now, but it should also be removed soon. - -Signed-off-by: Niklas Haas -Signed-off-by: James Almer ---- - doc/filters.texi | 3 --- - libavfilter/vf_libplacebo.c | 7 ++++--- - 2 files changed, 4 insertions(+), 6 deletions(-) - -diff --git a/doc/filters.texi b/doc/filters.texi -index 7a7b2ba4e79e..77b594f69cb1 100644 ---- a/doc/filters.texi -+++ b/doc/filters.texi -@@ -16242,9 +16242,6 @@ Disable linear light scaling. - @item disable_builtin - Disable built-in GPU sampling (forces LUT). - --@item force_icc_lut --Force the use of a full ICC 3DLUT for gamut mapping. -- - @item disable_fbos - Forcibly disable FBOs, resulting in loss of almost all functionality, but - offering the maximum possible speed. -diff --git a/libavfilter/vf_libplacebo.c b/libavfilter/vf_libplacebo.c -index d75723289069..757dc519e9ad 100644 ---- a/libavfilter/vf_libplacebo.c -+++ b/libavfilter/vf_libplacebo.c -@@ -97,7 +97,6 @@ typedef struct LibplaceboContext { - float polar_cutoff; - int disable_linear; - int disable_builtin; -- int force_icc_lut; - int force_dither; - int disable_fbos; - -@@ -139,6 +138,7 @@ typedef struct LibplaceboContext { - float desat_exp; - int gamut_warning; - int gamut_clipping; -+ int force_icc_lut; - #endif - - /* pl_dither_params */ -@@ -463,7 +463,6 @@ static int process_frames(AVFilterContext *avctx, AVFrame *out, AVFrame *in) - .polar_cutoff = s->polar_cutoff, - .disable_linear_scaling = s->disable_linear, - .disable_builtin_scalers = s->disable_builtin, -- .force_icc_lut = s->force_icc_lut, - .force_dither = s->force_dither, - .disable_fbos = s->disable_fbos, - }; -@@ -855,7 +854,9 @@ static const AVOption libplacebo_options[] = { - { "polar_cutoff", "Polar LUT cutoff", OFFSET(polar_cutoff), AV_OPT_TYPE_FLOAT, {.dbl = 0}, 0.0, 1.0, DYNAMIC }, - { "disable_linear", "Disable linear scaling", OFFSET(disable_linear), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, DYNAMIC }, - { "disable_builtin", "Disable built-in scalers", OFFSET(disable_builtin), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, DYNAMIC }, -- { "force_icc_lut", "Force the use of a full ICC 3DLUT for color mapping", OFFSET(force_icc_lut), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, DYNAMIC }, -+#if FF_API_LIBPLACEBO_OPTS -+ { "force_icc_lut", "Deprecated, does nothing", OFFSET(force_icc_lut), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, DYNAMIC | AV_OPT_FLAG_DEPRECATED }, -+#endif - { "force_dither", "Force dithering", OFFSET(force_dither), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, DYNAMIC }, - { "disable_fbos", "Force-disable FBOs", OFFSET(disable_fbos), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, DYNAMIC }, - { NULL }, --- -2.39.2 - diff --git a/0001-avfilter-vf_libplacebo-wrap-deprecated-opts-in-FF_AP.patch b/0001-avfilter-vf_libplacebo-wrap-deprecated-opts-in-FF_AP.patch deleted file mode 100644 index 2d2a939..0000000 --- a/0001-avfilter-vf_libplacebo-wrap-deprecated-opts-in-FF_AP.patch +++ /dev/null @@ -1,76 +0,0 @@ -From 11eca6018c40f5ebe6af93cbc4b4dce447d8b3bc Mon Sep 17 00:00:00 2001 -From: Niklas Haas -Date: Mon, 13 Mar 2023 15:10:26 +0100 -Subject: [PATCH] avfilter/vf_libplacebo: wrap deprecated opts in FF_API define - -Signed-off-by: Niklas Haas -Signed-off-by: James Almer ---- - libavfilter/version_major.h | 2 ++ - libavfilter/vf_libplacebo.c | 8 ++++++++ - 2 files changed, 10 insertions(+) - -diff --git a/libavfilter/version_major.h b/libavfilter/version_major.h -index 899dfdb27dba..1decc4012ee0 100644 ---- a/libavfilter/version_major.h -+++ b/libavfilter/version_major.h -@@ -35,4 +35,6 @@ - * the public API and may change, break or disappear at any time. - */ - -+#define FF_API_LIBPLACEBO_OPTS (LIBAVFILTER_VERSION_MAJOR < 10) -+ - #endif /* AVFILTER_VERSION_MAJOR_H */ -diff --git a/libavfilter/vf_libplacebo.c b/libavfilter/vf_libplacebo.c -index 7cd495de2619..d75723289069 100644 ---- a/libavfilter/vf_libplacebo.c -+++ b/libavfilter/vf_libplacebo.c -@@ -132,11 +132,14 @@ typedef struct LibplaceboContext { - int inverse_tonemapping; - float crosstalk; - int tonemapping_lut_size; -+ -+#if FF_API_LIBPLACEBO_OPTS - /* for backwards compatibility */ - float desat_str; - float desat_exp; - int gamut_warning; - int gamut_clipping; -+#endif - - /* pl_dither_params */ - int dithering; -@@ -380,6 +383,7 @@ static int process_frames(AVFilterContext *avctx, AVFrame *out, AVFrame *in) - pl_rect2df_aspect_set(&target.crop, aspect, s->pad_crop_ratio); - } - -+#if FF_API_LIBPLACEBO_OPTS - /* backwards compatibility with older API */ - if (!tonemapping_mode && (s->desat_str >= 0.0f || s->desat_exp >= 0.0f)) { - float str = s->desat_str < 0.0f ? 0.9f : s->desat_str; -@@ -397,6 +401,7 @@ static int process_frames(AVFilterContext *avctx, AVFrame *out, AVFrame *in) - gamut_mode = PL_GAMUT_WARN; - if (s->gamut_clipping) - gamut_mode = PL_GAMUT_DESATURATE; -+#endif - - /* Update render params */ - params = (struct pl_render_params) { -@@ -818,11 +823,14 @@ static const AVOption libplacebo_options[] = { - { "inverse_tonemapping", "Inverse tone mapping (range expansion)", OFFSET(inverse_tonemapping), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, DYNAMIC }, - { "tonemapping_crosstalk", "Crosstalk factor for tone-mapping", OFFSET(crosstalk), AV_OPT_TYPE_FLOAT, {.dbl = 0.04}, 0.0, 0.30, DYNAMIC }, - { "tonemapping_lut_size", "Tone-mapping LUT size", OFFSET(tonemapping_lut_size), AV_OPT_TYPE_INT, {.i64 = 256}, 2, 1024, DYNAMIC }, -+ -+#if FF_API_LIBPLACEBO_OPTS - /* deprecated options for backwards compatibility, defaulting to -1 to not override the new defaults */ - { "desaturation_strength", "Desaturation strength", OFFSET(desat_str), AV_OPT_TYPE_FLOAT, {.dbl = -1.0}, -1.0, 1.0, DYNAMIC | AV_OPT_FLAG_DEPRECATED }, - { "desaturation_exponent", "Desaturation exponent", OFFSET(desat_exp), AV_OPT_TYPE_FLOAT, {.dbl = -1.0}, -1.0, 10.0, DYNAMIC | AV_OPT_FLAG_DEPRECATED }, - { "gamut_warning", "Highlight out-of-gamut colors", OFFSET(gamut_warning), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, DYNAMIC | AV_OPT_FLAG_DEPRECATED }, - { "gamut_clipping", "Enable colorimetric gamut clipping", OFFSET(gamut_clipping), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, DYNAMIC | AV_OPT_FLAG_DEPRECATED }, -+#endif - - { "dithering", "Dither method to use", OFFSET(dithering), AV_OPT_TYPE_INT, {.i64 = PL_DITHER_BLUE_NOISE}, -1, PL_DITHER_METHOD_COUNT - 1, DYNAMIC, "dither" }, - { "none", "Disable dithering", 0, AV_OPT_TYPE_CONST, {.i64 = -1}, 0, 0, STATIC, "dither" }, --- -2.39.2 - diff --git a/0001-fftools-ffmpeg_filter-initialize-the-o-to-silence-th.patch b/0001-fftools-ffmpeg_filter-initialize-the-o-to-silence-th.patch deleted file mode 100644 index 85b43a4..0000000 --- a/0001-fftools-ffmpeg_filter-initialize-the-o-to-silence-th.patch +++ /dev/null @@ -1,30 +0,0 @@ -From a0a0a804998da8d1a397479c9bafeb000e6be088 Mon Sep 17 00:00:00 2001 -From: Jun Zhao -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 ---- - 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 - diff --git a/0001-lavc-Makefile-build-vulkan-decode-code-if-vulkan_av1.patch b/0001-lavc-Makefile-build-vulkan-decode-code-if-vulkan_av1.patch new file mode 100644 index 0000000..021aaae --- /dev/null +++ b/0001-lavc-Makefile-build-vulkan-decode-code-if-vulkan_av1.patch @@ -0,0 +1,27 @@ +From b7c696af10784110844cc3dbe0ec21538393f309 Mon Sep 17 00:00:00 2001 +From: Lynne +Date: Sun, 3 Dec 2023 21:02:13 +0100 +Subject: [PATCH] lavc/Makefile: build vulkan decode code if vulkan_av1 has + been enabled + +Forgotten. +--- + libavcodec/Makefile | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/libavcodec/Makefile b/libavcodec/Makefile +index 748806e702..fd9883d2ca 100644 +--- a/libavcodec/Makefile ++++ b/libavcodec/Makefile +@@ -998,7 +998,7 @@ OBJS-$(CONFIG_AV1_DXVA2_HWACCEL) += dxva2_av1.o + OBJS-$(CONFIG_AV1_NVDEC_HWACCEL) += nvdec_av1.o + OBJS-$(CONFIG_AV1_VAAPI_HWACCEL) += vaapi_av1.o + OBJS-$(CONFIG_AV1_VDPAU_HWACCEL) += vdpau_av1.o +-OBJS-$(CONFIG_AV1_VULKAN_HWACCEL) += vulkan_av1.o ++OBJS-$(CONFIG_AV1_VULKAN_HWACCEL) += vulkan_decode.o vulkan_av1.o + OBJS-$(CONFIG_H263_VAAPI_HWACCEL) += vaapi_mpeg4.o + OBJS-$(CONFIG_H263_VIDEOTOOLBOX_HWACCEL) += videotoolbox.o + OBJS-$(CONFIG_H264_D3D11VA_HWACCEL) += dxva2_h264.o +-- +2.43.0 + diff --git a/FFmpeg-devel-v10-Support-enhanced-flv-in-FFmpeg.patch b/FFmpeg-devel-v10-Support-enhanced-flv-in-FFmpeg.patch deleted file mode 100644 index 28ff7bb..0000000 --- a/FFmpeg-devel-v10-Support-enhanced-flv-in-FFmpeg.patch +++ /dev/null @@ -1,1230 +0,0 @@ -From patchwork Mon May 15 08:31:56 2023 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -X-Patchwork-Submitter: Steven Liu -X-Patchwork-Id: 41615 -Delivered-To: ffmpegpatchwork2@gmail.com -Received: by 2002:a05:6a20:ba91:b0:105:feb:71f2 with SMTP id - fb17csp1443896pzb; - Mon, 15 May 2023 01:33:01 -0700 (PDT) -X-Google-Smtp-Source: - ACHHUZ69PgG6fq/KF6IIeKoVV29fkg7cAJfmPD3LnnTmI9YYVAPo/alZm7B+7f+FoOgn9rHdYUo5 -X-Received: by 2002:a17:907:97cb:b0:96a:4654:9a57 with SMTP id - js11-20020a17090797cb00b0096a46549a57mr16869758ejc.54.1684139580951; - Mon, 15 May 2023 01:33:00 -0700 (PDT) -ARC-Seal: i=1; a=rsa-sha256; t=1684139580; cv=none; - d=google.com; s=arc-20160816; - b=iOREUkvWDLqSJl40trM7wg3ufEQ23FOBLjpslXsds5HWyK48b/76lFgQwRfHJbHqbh - vc4N6DopB5msRi0VK/pJnDAdtuyQR2tqEgLvbZpHJzjK1zHUKRV5JHlmVhNvQOfYWpMR - VL/1OMmbTctEza2Z7/VYsrVLHLy4QOlLh4w/JdRcx/7rhiOA1ixpMxC4qUb5IGMhnqen - P2dDbAoqdmGUZtmA4VOfxkgkHnIaeFv+UffJGIZs1Lyb7c3zytwdpLLiezRzVLWQaStW - TVdcDk45pOrA29lZ46Tq8YNJP7O5zfSevFIqrB85mUjSNoyZi24gz19yxJa/09O1qb+o - thzw== -ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; - s=arc-20160816; - h=sender:errors-to:content-transfer-encoding:cc:reply-to - :list-subscribe:list-help:list-post:list-archive:list-unsubscribe - :list-id:precedence:subject:feedback-id:mime-version:references - :in-reply-to:message-id:date:to:from:delivered-to; - bh=Qg7uugO6uqQCX67+SdNELVYF39/WDPRDFt1+H7toQ+s=; - b=b1cxdqSVG1Oc157HlNUA+LfJhknU/nr3g5wnSLXmP7DrR+RQp2CFwGfjV+wTkfWLok - WydumkYG2biOpmhMi+mG4ci5WvU2R9bv1qpKGreRpsImGmjubQxu5CC9gwmenz3c+1v8 - pu+qkw142w9uMerjOpaw6oWvaHq9hWGVy6Uni33AqMJhfj9WqSwBCezk62krxzBar/VN - XNbzzpAMIuXcj0DcHS70oDHOTbtLq4uDLGpkQwnBpYbswfGD0h8N+B+BSCs3ZqN/l5Jc - juIQY4i3ja2W1yHm6Zlze2qU8lFRPzRwVBZBv9vro88VyFic0UZx9wRuIqJB9BZIb0h/ - vkiA== -ARC-Authentication-Results: i=1; mx.google.com; - spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org - designates 79.124.17.100 as permitted sender) - smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org -Return-Path: -Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) - by mx.google.com with ESMTP id - gt37-20020a1709072da500b0096b1c38458dsi2828116ejc.409.2023.05.15.01.33.00; - Mon, 15 May 2023 01:33:00 -0700 (PDT) -Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org - designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; -Authentication-Results: mx.google.com; - spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org - designates 79.124.17.100 as permitted sender) - smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org -Received: from [127.0.1.1] (localhost [127.0.0.1]) - by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id D930568BE0C; - Mon, 15 May 2023 11:32:57 +0300 (EEST) -X-Original-To: ffmpeg-devel@ffmpeg.org -Delivered-To: ffmpeg-devel@ffmpeg.org -Received: from bg4.exmail.qq.com (bg4.exmail.qq.com [43.155.67.158]) - by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 522F7680274 - for ; Mon, 15 May 2023 11:32:49 +0300 (EEST) -X-QQ-mid: bizesmtp68t1684139564tg642pbl -Received: from localhost ( [103.102.203.204]) by bizesmtp.qq.com (ESMTP) with - id ; Mon, 15 May 2023 16:32:42 +0800 (CST) -X-QQ-SSF: 01100000000000Z0Z000000A0000000 -X-QQ-FEAT: nCMT0YKS3i1MU7IXSsiS1Rwde6i/4Rq2kuPO2PoXw3OvtJB24MU+Y2GwdEg4Y - pg0ZfSggM3VBmRCkHI3ioSOH2mvVyYG9LgwhhyfixPaFItcpF4EF6xoZepQpa1H5v1BDi7s - iwCwF3shgH8dl96iJKKryT4TtjUTnYRoRhCPtLCGfUthaM/R44xdqxRvjDqIVn1BUMb5GPu - DMuaskzO8QQCFxvduUvovkXjJc5v17Krm2lf945Tmm/pIpV/qLjAgAhYHqOoxrgBGHZDYWY - 0XeS7RvYkKTR24z9m9Sk75veOTKtFzksnbLJYkIDYj+voAd1djXPJWtuB2elhm/DIa9+5lW - 2DnKrJ/Bb2Ok13ggXoC600jHcxkLbuOqDuK5k5Dhub7ECOTPJythkMV+FYQCw== -X-QQ-GoodBg: 0 -X-BIZMAIL-ID: 14547348156280638791 -From: Steven Liu -To: ffmpeg-devel@ffmpeg.org -Date: Mon, 15 May 2023 16:31:56 +0800 -Message-Id: <20230515083201.48201-2-lq@chinaffmpeg.org> -X-Mailer: git-send-email 2.40.0 -In-Reply-To: <20230515083201.48201-1-lq@chinaffmpeg.org> -References: - - <20230515083201.48201-1-lq@chinaffmpeg.org> -MIME-Version: 1.0 -X-QQ-SENDSIZE: 520 -Feedback-ID: bizesmtp:chinaffmpeg.org:qybglogicsvrsz:qybglogicsvrsz3a-3 -Subject: [FFmpeg-devel] [PATCH v10 1/6] avformat/flvenc: support mux hevc in - enhanced flv -X-BeenThere: ffmpeg-devel@ffmpeg.org -X-Mailman-Version: 2.1.29 -Precedence: list -List-Id: FFmpeg development discussions and patches -List-Unsubscribe: , - -List-Archive: -List-Post: -List-Help: -List-Subscribe: , - -Reply-To: FFmpeg development discussions and patches -Cc: Steven Liu -Errors-To: ffmpeg-devel-bounces@ffmpeg.org -Sender: "ffmpeg-devel" -X-TUID: WUhHC4/dXuk+ - -Signed-off-by: Steven Liu ---- - libavformat/Makefile | 2 +- - libavformat/flv.h | 15 +++++++++++++++ - libavformat/flvenc.c | 38 +++++++++++++++++++++++++++++--------- - 3 files changed, 45 insertions(+), 10 deletions(-) - -diff --git a/libavformat/Makefile b/libavformat/Makefile -index f8ad7c6a11..1ef3d15467 100644 ---- a/libavformat/Makefile -+++ b/libavformat/Makefile -@@ -214,7 +214,7 @@ OBJS-$(CONFIG_FLAC_MUXER) += flacenc.o flacenc_header.o \ - OBJS-$(CONFIG_FLIC_DEMUXER) += flic.o - OBJS-$(CONFIG_FLV_DEMUXER) += flvdec.o - OBJS-$(CONFIG_LIVE_FLV_DEMUXER) += flvdec.o --OBJS-$(CONFIG_FLV_MUXER) += flvenc.o avc.o -+OBJS-$(CONFIG_FLV_MUXER) += flvenc.o avc.o hevc.o - OBJS-$(CONFIG_FOURXM_DEMUXER) += 4xm.o - OBJS-$(CONFIG_FRAMECRC_MUXER) += framecrcenc.o framehash.o - OBJS-$(CONFIG_FRAMEHASH_MUXER) += hashenc.o framehash.o -diff --git a/libavformat/flv.h b/libavformat/flv.h -index 3571b90279..91e0a4140c 100644 ---- a/libavformat/flv.h -+++ b/libavformat/flv.h -@@ -35,6 +35,12 @@ - - #define FLV_VIDEO_FRAMETYPE_OFFSET 4 - -+/* Extended VideoTagHeader -+ * defined in reference link: -+ * https://github.com/veovera/enhanced-rtmp/blob/main/enhanced-rtmp-v1.pdf -+ * */ -+#define FLV_IS_EX_HEADER 0x80 -+ - /* bitmasks to isolate specific values */ - #define FLV_AUDIO_CHANNEL_MASK 0x01 - #define FLV_AUDIO_SAMPLESIZE_MASK 0x02 -@@ -112,6 +118,15 @@ enum { - FLV_CODECID_MPEG4 = 9, - }; - -+enum { -+ PacketTypeSequenceStart = 0, -+ PacketTypeCodedFrames = 1, -+ PacketTypeSequenceEnd = 2, -+ PacketTypeCodedFramesX = 3, -+ PacketTypeMetadata = 4, -+ PacketTypeMPEG2TSSequenceStart = 5, -+}; -+ - enum { - FLV_FRAME_KEY = 1 << FLV_VIDEO_FRAMETYPE_OFFSET, ///< key frame (for AVC, a seekable frame) - FLV_FRAME_INTER = 2 << FLV_VIDEO_FRAMETYPE_OFFSET, ///< inter frame (for AVC, a non-seekable frame) -diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c -index 721f062811..35e198fa15 100644 ---- a/libavformat/flvenc.c -+++ b/libavformat/flvenc.c -@@ -28,6 +28,7 @@ - #include "libavcodec/mpeg4audio.h" - #include "avio.h" - #include "avc.h" -+#include "hevc.h" - #include "avformat.h" - #include "flv.h" - #include "internal.h" -@@ -46,6 +47,7 @@ static const AVCodecTag flv_video_codec_ids[] = { - { AV_CODEC_ID_VP6, FLV_CODECID_VP6 }, - { AV_CODEC_ID_VP6A, FLV_CODECID_VP6A }, - { AV_CODEC_ID_H264, FLV_CODECID_H264 }, -+ { AV_CODEC_ID_HEVC, MKBETAG('h', 'v', 'c', '1') }, - { AV_CODEC_ID_NONE, 0 } - }; - -@@ -489,7 +491,7 @@ static void flv_write_codec_header(AVFormatContext* s, AVCodecParameters* par, i - FLVContext *flv = s->priv_data; - - if (par->codec_id == AV_CODEC_ID_AAC || par->codec_id == AV_CODEC_ID_H264 -- || par->codec_id == AV_CODEC_ID_MPEG4) { -+ || par->codec_id == AV_CODEC_ID_MPEG4 || par->codec_id == AV_CODEC_ID_HEVC) { - int64_t pos; - avio_w8(pb, - par->codec_type == AVMEDIA_TYPE_VIDEO ? -@@ -532,10 +534,19 @@ static void flv_write_codec_header(AVFormatContext* s, AVCodecParameters* par, i - } - avio_write(pb, par->extradata, par->extradata_size); - } else { -- avio_w8(pb, par->codec_tag | FLV_FRAME_KEY); // flags -- avio_w8(pb, 0); // AVC sequence header -- avio_wb24(pb, 0); // composition time -- ff_isom_write_avcc(pb, par->extradata, par->extradata_size); -+ if (par->codec_id == AV_CODEC_ID_HEVC) { -+ avio_w8(pb, FLV_IS_EX_HEADER | PacketTypeSequenceStart); // ExVideoTagHeader mode with PacketTypeSequenceStart -+ avio_write(pb, "hvc1", 4); -+ } else { -+ avio_w8(pb, par->codec_tag | FLV_FRAME_KEY); // flags -+ avio_w8(pb, 0); // AVC sequence header -+ avio_wb24(pb, 0); // composition time -+ } -+ -+ if (par->codec_id == AV_CODEC_ID_HEVC) -+ ff_isom_write_hvcc(pb, par->extradata, par->extradata_size, 0); -+ else -+ ff_isom_write_avcc(pb, par->extradata, par->extradata_size); - } - data_size = avio_tell(pb) - pos; - avio_seek(pb, -data_size - 10, SEEK_CUR); -@@ -832,13 +843,13 @@ static int flv_write_packet(AVFormatContext *s, AVPacket *pkt) - if (par->codec_id == AV_CODEC_ID_VP6F || par->codec_id == AV_CODEC_ID_VP6A || - par->codec_id == AV_CODEC_ID_VP6 || par->codec_id == AV_CODEC_ID_AAC) - flags_size = 2; -- else if (par->codec_id == AV_CODEC_ID_H264 || par->codec_id == AV_CODEC_ID_MPEG4) -+ else if (par->codec_id == AV_CODEC_ID_H264 || par->codec_id == AV_CODEC_ID_MPEG4 || par->codec_id == AV_CODEC_ID_HEVC) - flags_size = 5; - else - flags_size = 1; - - if (par->codec_id == AV_CODEC_ID_AAC || par->codec_id == AV_CODEC_ID_H264 -- || par->codec_id == AV_CODEC_ID_MPEG4) { -+ || par->codec_id == AV_CODEC_ID_MPEG4 || par->codec_id == AV_CODEC_ID_HEVC) { - size_t side_size; - uint8_t *side = av_packet_get_side_data(pkt, AV_PKT_DATA_NEW_EXTRADATA, &side_size); - if (side && side_size > 0 && (side_size != par->extradata_size || memcmp(side, par->extradata, side_size))) { -@@ -858,7 +869,7 @@ static int flv_write_packet(AVFormatContext *s, AVPacket *pkt) - "Packets are not in the proper order with respect to DTS\n"); - return AVERROR(EINVAL); - } -- if (par->codec_id == AV_CODEC_ID_H264 || par->codec_id == AV_CODEC_ID_MPEG4) { -+ if (par->codec_id == AV_CODEC_ID_H264 || par->codec_id == AV_CODEC_ID_MPEG4 || par->codec_id == AV_CODEC_ID_HEVC) { - if (pkt->pts == AV_NOPTS_VALUE) { - av_log(s, AV_LOG_ERROR, "Packet is missing PTS\n"); - return AVERROR(EINVAL); -@@ -903,6 +914,10 @@ static int flv_write_packet(AVFormatContext *s, AVPacket *pkt) - if (par->extradata_size > 0 && *(uint8_t*)par->extradata != 1) - if ((ret = ff_avc_parse_nal_units_buf(pkt->data, &data, &size)) < 0) - return ret; -+ } else if (par->codec_id == AV_CODEC_ID_HEVC) { -+ if (par->extradata_size > 0 && *(uint8_t*)par->extradata != 1) -+ if ((ret = ff_hevc_annexb2mp4_buf(pkt->data, &data, &size, 0, NULL)) < 0) -+ return ret; - } else if (par->codec_id == AV_CODEC_ID_AAC && pkt->size > 2 && - (AV_RB16(pkt->data) & 0xfff0) == 0xfff0) { - if (!s->streams[pkt->stream_index]->nb_frames) { -@@ -964,7 +979,12 @@ static int flv_write_packet(AVFormatContext *s, AVPacket *pkt) - avio_wb32(pb, data_size + 11); - } else { - av_assert1(flags>=0); -- avio_w8(pb,flags); -+ if (par->codec_id == AV_CODEC_ID_HEVC) { -+ avio_w8(pb, FLV_IS_EX_HEADER | PacketTypeCodedFramesX); // ExVideoTagHeader mode with PacketTypeCodedFramesX -+ avio_write(pb, "hvc1", 4); -+ } else { -+ avio_w8(pb, flags); -+ } - if (par->codec_id == AV_CODEC_ID_VP6) - avio_w8(pb,0); - if (par->codec_id == AV_CODEC_ID_VP6F || par->codec_id == AV_CODEC_ID_VP6A) { - -From patchwork Mon May 15 08:31:57 2023 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -X-Patchwork-Submitter: Steven Liu -X-Patchwork-Id: 41616 -Delivered-To: ffmpegpatchwork2@gmail.com -Received: by 2002:a05:6a20:ba91:b0:105:feb:71f2 with SMTP id - fb17csp1444123pzb; - Mon, 15 May 2023 01:33:22 -0700 (PDT) -X-Google-Smtp-Source: - ACHHUZ4qSqnHARATYvNTOiXhMIIgGWUHo612wN3Ui1r3cYPQd57E+B9kiCRYijDhzgObKMKkDm54 -X-Received: by 2002:a17:907:6e8e:b0:94f:3521:396 with SMTP id - sh14-20020a1709076e8e00b0094f35210396mr35740883ejc.23.1684139602011; - Mon, 15 May 2023 01:33:22 -0700 (PDT) -ARC-Seal: i=1; a=rsa-sha256; t=1684139601; cv=none; - d=google.com; s=arc-20160816; - b=EFJgx9cm5ew2+PIpTeHi7QCzos//oOs5q/HndQxc0+dHYlju5X4rVSACmfk9L0DH3j - +cG0n2/3wAsguA1rC3B8a+qXkRfAXC1ropuhDwKCZCdw0Iv40Vm4JeHolEQWRni8Ko+F - MhWY7AvxrX4GsO0pp4SfKsVFaJdo18dlpn+BUd9FX5N7V6lUTadQsVcJYJBd2B2MIRUi - mJaEPp8WpRkiS92DgWhPzUC9ELnwrySnNL0mOo9DCd9cjFXQ9KXW6qjRoP0blbL8N2ws - BlY2dJVmSM36n/GK9gZb+6fUg3xVufDUfdRr0m4jpa/ILD93/nwAZsqhk3k4j00se+CO - 7Vrw== -ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; - s=arc-20160816; - h=sender:errors-to:content-transfer-encoding:cc:reply-to - :list-subscribe:list-help:list-post:list-archive:list-unsubscribe - :list-id:precedence:subject:feedback-id:mime-version:references - :in-reply-to:message-id:date:to:from:delivered-to; - bh=ygUb60Tr5LbPnhiS1As+hL+qX45KII+ocpY9X3Jq4TI=; - b=UpGhqbfo/+m9WW5qE92LKOdOlxkCWyy2QVqiXCjXpxepdDd0IKkhGqSspte9zJrUT8 - QWg8IiDK6JTnGnvp+hO6doZjhXc1GyyTx6cMQQX+2JzqTtbWF03S94GwBgmN/U2RIK9M - f980SSgfNZRSJF5kJ+dO2ix4M5WIWhxEYB/MRzn/RbxAvYkwLNG1gMMBTNimogbFsXRo - h5WgGxO4k8mx/x8PBrtNv1aPZ86FAcXC3Aieao7aVnRDvWjepEus5jEfGu2QuqnvM2qK - WIjUyFrppJL/crANtgR+tFcL8395bRGYObYtIBblUQ/g5ddHzjsaClJ/42r3h1vez39q - nPjQ== -ARC-Authentication-Results: i=1; mx.google.com; - spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org - designates 79.124.17.100 as permitted sender) - smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org -Return-Path: -Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) - by mx.google.com with ESMTP id - v21-20020a1709060b5500b0095ec54a22bcsi10907595ejg.106.2023.05.15.01.33.21; - Mon, 15 May 2023 01:33:21 -0700 (PDT) -Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org - designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; -Authentication-Results: mx.google.com; - spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org - designates 79.124.17.100 as permitted sender) - smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org -Received: from [127.0.1.1] (localhost [127.0.0.1]) - by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id D3F7668C092; - Mon, 15 May 2023 11:33:18 +0300 (EEST) -X-Original-To: ffmpeg-devel@ffmpeg.org -Delivered-To: ffmpeg-devel@ffmpeg.org -Received: from bg4.exmail.qq.com (bg4.exmail.qq.com [43.155.67.158]) - by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8180368C004 - for ; Mon, 15 May 2023 11:33:11 +0300 (EEST) -X-QQ-mid: bizesmtp62t1684139585txhp32ou -Received: from localhost ( [103.102.203.204]) by bizesmtp.qq.com (ESMTP) with - id ; Mon, 15 May 2023 16:33:04 +0800 (CST) -X-QQ-SSF: 01100000000000Z0Z000000A0000000 -X-QQ-FEAT: 6ArnuSDJ+inVC06MH1nrJeu56+35diptW3dCdHt3bMayFZoCyE8QyUO0QY9zm - iY62JCSpSKYEK4ca2kpxkB99PI50FiWfNtzLDZ+VzUTy013GMpLwh1CWeVX5cF15RyEAIC9 - u3Ozg7IY8mv+GiDtf6FDgSyumE1D93qxV1R2sJ5v38V3NbNPcikg0aDxZXOlC+Hr+LdhsZi - 4X5tDi3NovhpCf+8Wo+ZaejHOrE8MUcUGpbh8dHRew6dnmkdkK5ytSHSZEye8RsXZnMdp4A - mqBZqIDGw1a4e04JAc/NDCs7qq4qthxMFB1skhaOv6DLcL+EqV2QFwnJn7V5Oof7BwfjaTG - mEAVpiZDnQhFvOgHemH1v61Blub2nCnAurrGhGMaywIzFXT87aOSLCDlFprSg== -X-QQ-GoodBg: 0 -X-BIZMAIL-ID: 11210839191292587357 -From: Steven Liu -To: ffmpeg-devel@ffmpeg.org -Date: Mon, 15 May 2023 16:31:57 +0800 -Message-Id: <20230515083201.48201-3-lq@chinaffmpeg.org> -X-Mailer: git-send-email 2.40.0 -In-Reply-To: <20230515083201.48201-1-lq@chinaffmpeg.org> -References: - - <20230515083201.48201-1-lq@chinaffmpeg.org> -MIME-Version: 1.0 -X-QQ-SENDSIZE: 520 -Feedback-ID: bizesmtp:chinaffmpeg.org:qybglogicsvrsz:qybglogicsvrsz3a-3 -Subject: [FFmpeg-devel] [PATCH v10 2/6] avformat/flvdec: support demux hevc - in enhanced flv -X-BeenThere: ffmpeg-devel@ffmpeg.org -X-Mailman-Version: 2.1.29 -Precedence: list -List-Id: FFmpeg development discussions and patches -List-Unsubscribe: , - -List-Archive: -List-Post: -List-Help: -List-Subscribe: , - -Reply-To: FFmpeg development discussions and patches -Cc: Steven Liu -Errors-To: ffmpeg-devel-bounces@ffmpeg.org -Sender: "ffmpeg-devel" -X-TUID: SFsjHMHu2ISl - -Signed-off-by: Steven Liu ---- - libavformat/flvdec.c | 58 ++++++++++++++++++++++++++++++++++++++------ - 1 file changed, 50 insertions(+), 8 deletions(-) - -diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c -index d83edff727..c8e6cadf1c 100644 ---- a/libavformat/flvdec.c -+++ b/libavformat/flvdec.c -@@ -79,6 +79,8 @@ typedef struct FLVContext { - int64_t last_ts; - int64_t time_offset; - int64_t time_pos; -+ -+ uint8_t exheader; - } FLVContext; - - /* AMF date type */ -@@ -302,13 +304,25 @@ static void flv_set_audio_codec(AVFormatContext *s, AVStream *astream, - } - } - --static int flv_same_video_codec(AVCodecParameters *vpar, int flags) -+static int flv_same_video_codec(AVFormatContext *s, AVCodecParameters *vpar, int flags) - { - int flv_codecid = flags & FLV_VIDEO_CODECID_MASK; -+ FLVContext *flv = s->priv_data; - - if (!vpar->codec_id && !vpar->codec_tag) - return 1; - -+ if (flv->exheader) { -+ uint8_t *codec_id_str = (uint8_t *)s->pb->buf_ptr; -+ uint32_t codec_id = codec_id_str[3] | codec_id_str[2] << 8 | codec_id_str[1] << 16 | codec_id_str[0] << 24; -+ switch(codec_id) { -+ case MKBETAG('h', 'v', 'c', '1'): -+ return vpar->codec_id == AV_CODEC_ID_HEVC; -+ default: -+ break; -+ } -+ } -+ - switch (flv_codecid) { - case FLV_CODECID_H263: - return vpar->codec_id == AV_CODEC_ID_FLV1; -@@ -331,9 +345,24 @@ static int flv_set_video_codec(AVFormatContext *s, AVStream *vstream, - int flv_codecid, int read) - { - FFStream *const vstreami = ffstream(vstream); -+ FLVContext *flv = s->priv_data; - int ret = 0; - AVCodecParameters *par = vstream->codecpar; - enum AVCodecID old_codec_id = vstream->codecpar->codec_id; -+ flv_codecid &= FLV_VIDEO_CODECID_MASK; -+ -+ if (flv->exheader) { -+ uint32_t codec_id = avio_rb32(s->pb); -+ -+ switch(codec_id) { -+ case MKBETAG('h', 'v', 'c', '1'): -+ par->codec_id = AV_CODEC_ID_HEVC; -+ vstreami->need_parsing = AVSTREAM_PARSE_HEADERS; -+ return 4; -+ default: -+ break; -+ } -+ } - switch (flv_codecid) { - case FLV_CODECID_H263: - par->codec_id = AV_CODEC_ID_FLV1; -@@ -796,6 +825,7 @@ static int flv_read_header(AVFormatContext *s) - s->start_time = 0; - flv->sum_flv_tag_size = 0; - flv->last_keyframe_stream_index = -1; -+ flv->exheader = 0; - - return 0; - } -@@ -1071,6 +1101,11 @@ retry: - } else if (type == FLV_TAG_TYPE_VIDEO) { - stream_type = FLV_STREAM_TYPE_VIDEO; - flags = avio_r8(s->pb); -+ /* -+ * Reference Enhancing FLV 2023-03-v1.0.0-B.8 -+ * https://github.com/veovera/enhanced-rtmp/blob/main/enhanced-rtmp-v1.pdf -+ * */ -+ flv->exheader = (flags >> 7) & 1; - size--; - if ((flags & FLV_VIDEO_FRAMETYPE_MASK) == FLV_FRAME_VIDEO_INFO_CMD) - goto skip; -@@ -1129,7 +1164,7 @@ skip: - break; - } else if (stream_type == FLV_STREAM_TYPE_VIDEO) { - if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && -- (s->video_codec_id || flv_same_video_codec(st->codecpar, flags))) -+ (s->video_codec_id || flv_same_video_codec(s, st->codecpar, flags))) - break; - } else if (stream_type == FLV_STREAM_TYPE_SUBTITLE) { - if (st->codecpar->codec_type == AVMEDIA_TYPE_SUBTITLE) -@@ -1230,7 +1265,7 @@ retry_duration: - avcodec_parameters_free(&par); - } - } else if (stream_type == FLV_STREAM_TYPE_VIDEO) { -- int ret = flv_set_video_codec(s, st, flags & FLV_VIDEO_CODECID_MASK, 1); -+ int ret = flv_set_video_codec(s, st, flags, 1); - if (ret < 0) - return ret; - size -= ret; -@@ -1242,16 +1277,23 @@ retry_duration: - - if (st->codecpar->codec_id == AV_CODEC_ID_AAC || - st->codecpar->codec_id == AV_CODEC_ID_H264 || -- st->codecpar->codec_id == AV_CODEC_ID_MPEG4) { -- int type = avio_r8(s->pb); -- size--; -+ st->codecpar->codec_id == AV_CODEC_ID_MPEG4 || -+ st->codecpar->codec_id == AV_CODEC_ID_HEVC) { -+ int type = 0; -+ if (flv->exheader && stream_type == FLV_STREAM_TYPE_VIDEO) { -+ type = flags & 0x0F; -+ } else { -+ type = avio_r8(s->pb); -+ size--; -+ } - - if (size < 0) { - ret = AVERROR_INVALIDDATA; - goto leave; - } - -- if (st->codecpar->codec_id == AV_CODEC_ID_H264 || st->codecpar->codec_id == AV_CODEC_ID_MPEG4) { -+ if (st->codecpar->codec_id == AV_CODEC_ID_H264 || st->codecpar->codec_id == AV_CODEC_ID_MPEG4 || -+ (st->codecpar->codec_id == AV_CODEC_ID_HEVC && type == PacketTypeCodedFrames)) { - // sign extension - int32_t cts = (avio_rb24(s->pb) + 0xff800000) ^ 0xff800000; - pts = av_sat_add64(dts, cts); -@@ -1267,7 +1309,7 @@ retry_duration: - } - } - if (type == 0 && (!st->codecpar->extradata || st->codecpar->codec_id == AV_CODEC_ID_AAC || -- st->codecpar->codec_id == AV_CODEC_ID_H264)) { -+ st->codecpar->codec_id == AV_CODEC_ID_H264 || st->codecpar->codec_id == AV_CODEC_ID_HEVC)) { - AVDictionaryEntry *t; - - if (st->codecpar->extradata) { - -From patchwork Mon May 15 08:31:58 2023 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -X-Patchwork-Submitter: Steven Liu -X-Patchwork-Id: 41617 -Delivered-To: ffmpegpatchwork2@gmail.com -Received: by 2002:a05:6a20:ba91:b0:105:feb:71f2 with SMTP id - fb17csp1444209pzb; - Mon, 15 May 2023 01:33:31 -0700 (PDT) -X-Google-Smtp-Source: - ACHHUZ5N/MWld9fXzokkRVS1e13AYakkRyH/RvyBiJ7xA512EWdWgrGE4ferugcTRoHNahvjayC9 -X-Received: by 2002:a17:907:9724:b0:96a:1260:dbf5 with SMTP id - jg36-20020a170907972400b0096a1260dbf5mr18082554ejc.45.1684139611447; - Mon, 15 May 2023 01:33:31 -0700 (PDT) -ARC-Seal: i=1; a=rsa-sha256; t=1684139611; cv=none; - d=google.com; s=arc-20160816; - b=op6Xl3YinOSd8d/Ya4YpQjHSbJx0t7fHaCHvvqvkJgTbKfjmTJjDFsMWkeT/ceA1lA - xV9Y1JGrAlZmudpgaJtXHukLJessnBrqaBy5gm0lX6bJ0X4AKJt/F7GB3FR3OPISq79w - 7djeHUx2VAxfWn1awCcFrcyyMPrGB2GPMdoXxcUVmySNNK0ohuroQ2JhVRajwj0sIBFg - f0pu7vXX9ct499tFl5rHEd//2Xl3rY6kNHfPlMOcJEclT+35TUaTWE88+rJODaiMArcZ - RaFK8xqfAOJjw0X9t6YiwBk1Kl/sFKEj71Fxu5khg7IvhF7kzRDSZXLCkKW9UvPYhGOl - 25Bw== -ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; - s=arc-20160816; - h=sender:errors-to:content-transfer-encoding:cc:reply-to - :list-subscribe:list-help:list-post:list-archive:list-unsubscribe - :list-id:precedence:subject:feedback-id:mime-version:references - :in-reply-to:message-id:date:to:from:delivered-to; - bh=0O0kUGD5r8lgXEiC2RUfiZ1ccVRPd03lWds0dqdVEq0=; - b=OAvZATeoNq/BI3pJd21Xz2nKh+ZI8Zkofe4Ob6USu1ZEOyZzK2xxgtxL6SjJAxecG6 - NfECg8e13DLbnVAB5OnMK8TY/HV/4N/iqPksn6PbJSkCyafRqg477+SRs7tOl89c3isr - Cp8o+j7t+gW2fkV9Y6L8MZa9etJpusa0LYXVBLPDs+tHNgXNec9UTA1YnoSyMqErrh58 - chMh6B6P+5aRcKrBfKZY1F8WAzMjphdQ78c3YZ+ikgGfkoPgRKTEUq+xQAMm7UXirMcn - qtndeDiQypN1eg7LiEbAsLhj7K2jibIlDmwUk+6JDE1ASz05FViAbk3nFfWydNP8iUlh - z+CQ== -ARC-Authentication-Results: i=1; mx.google.com; - spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org - designates 79.124.17.100 as permitted sender) - smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org -Return-Path: -Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) - by mx.google.com with ESMTP id - rv22-20020a17090710d600b00965e8c67d7dsi11399192ejb.285.2023.05.15.01.33.31; - Mon, 15 May 2023 01:33:31 -0700 (PDT) -Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org - designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; -Authentication-Results: mx.google.com; - spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org - designates 79.124.17.100 as permitted sender) - smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org -Received: from [127.0.1.1] (localhost [127.0.0.1]) - by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id CAF3668C08B; - Mon, 15 May 2023 11:33:22 +0300 (EEST) -X-Original-To: ffmpeg-devel@ffmpeg.org -Delivered-To: ffmpeg-devel@ffmpeg.org -Received: from bg4.exmail.qq.com (bg4.exmail.qq.com [43.155.67.158]) - by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 5613068C08B - for ; Mon, 15 May 2023 11:33:16 +0300 (EEST) -X-QQ-mid: bizesmtp62t1684139591t5vf5iss -Received: from localhost ( [103.102.203.204]) by bizesmtp.qq.com (ESMTP) with - id ; Mon, 15 May 2023 16:33:09 +0800 (CST) -X-QQ-SSF: 01100000000000Z0Z000000A0000000 -X-QQ-FEAT: 0VYWLLCf4rd8sf4B0xdI45yO9pa7cA5LkUN5r8jryl/9HUTcEOcDnq6sEFLpU - pZ/JnwSIqfqFtRB8Bq8+032WcwZIBdGWmOUpIZLcDlBPHVtS9YwSO56p7te0932mhQHQVWr - 2MJ60EhPcxfhXG3M89QSysYDgLjUIRbb/cP/Br05mCJ05c+Q4NzWwlRwweOG0lUJ4aMNli9 - i3Qf8lSAK8hK3JWYZP0Fg66JaFkZvw6Yz6N4ESVf4Vp85rwWKPfpBz538IiCze/ePbVgZWB - zvbU1mVAkapT05cTLyqAlv7tefflgoYcrW79Z+Opy2wSYDZLpCkRIe+w4yWG7eCg71dUgnc - 79D+MVyHSJjuXS/sQLaeFanS1V55WK4izy9J/bFHdSprmySwmpk8hf5zhIZOQ== -X-QQ-GoodBg: 0 -X-BIZMAIL-ID: 5377996165340525619 -From: Steven Liu -To: ffmpeg-devel@ffmpeg.org -Date: Mon, 15 May 2023 16:31:58 +0800 -Message-Id: <20230515083201.48201-4-lq@chinaffmpeg.org> -X-Mailer: git-send-email 2.40.0 -In-Reply-To: <20230515083201.48201-1-lq@chinaffmpeg.org> -References: - - <20230515083201.48201-1-lq@chinaffmpeg.org> -MIME-Version: 1.0 -X-QQ-SENDSIZE: 520 -Feedback-ID: bizesmtp:chinaffmpeg.org:qybglogicsvrsz:qybglogicsvrsz3a-3 -Subject: [FFmpeg-devel] [PATCH v10 3/6] avformat/flvenc: support mux av1 in - enhanced flv -X-BeenThere: ffmpeg-devel@ffmpeg.org -X-Mailman-Version: 2.1.29 -Precedence: list -List-Id: FFmpeg development discussions and patches -List-Unsubscribe: , - -List-Archive: -List-Post: -List-Help: -List-Subscribe: , - -Reply-To: FFmpeg development discussions and patches -Cc: Steven Liu -Errors-To: ffmpeg-devel-bounces@ffmpeg.org -Sender: "ffmpeg-devel" -X-TUID: dRfPdsIvexzh - -Signed-off-by: Steven Liu ---- - libavformat/Makefile | 2 +- - libavformat/flvenc.c | 22 ++++++++++++++++++---- - 2 files changed, 19 insertions(+), 5 deletions(-) - -diff --git a/libavformat/Makefile b/libavformat/Makefile -index 1ef3d15467..c868e1626c 100644 ---- a/libavformat/Makefile -+++ b/libavformat/Makefile -@@ -214,7 +214,7 @@ OBJS-$(CONFIG_FLAC_MUXER) += flacenc.o flacenc_header.o \ - OBJS-$(CONFIG_FLIC_DEMUXER) += flic.o - OBJS-$(CONFIG_FLV_DEMUXER) += flvdec.o - OBJS-$(CONFIG_LIVE_FLV_DEMUXER) += flvdec.o --OBJS-$(CONFIG_FLV_MUXER) += flvenc.o avc.o hevc.o -+OBJS-$(CONFIG_FLV_MUXER) += flvenc.o avc.o hevc.o av1.o - OBJS-$(CONFIG_FOURXM_DEMUXER) += 4xm.o - OBJS-$(CONFIG_FRAMECRC_MUXER) += framecrcenc.o framehash.o - OBJS-$(CONFIG_FRAMEHASH_MUXER) += hashenc.o framehash.o -diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c -index 35e198fa15..c1784b332d 100644 ---- a/libavformat/flvenc.c -+++ b/libavformat/flvenc.c -@@ -28,6 +28,7 @@ - #include "libavcodec/mpeg4audio.h" - #include "avio.h" - #include "avc.h" -+#include "av1.h" - #include "hevc.h" - #include "avformat.h" - #include "flv.h" -@@ -48,6 +49,7 @@ static const AVCodecTag flv_video_codec_ids[] = { - { AV_CODEC_ID_VP6A, FLV_CODECID_VP6A }, - { AV_CODEC_ID_H264, FLV_CODECID_H264 }, - { AV_CODEC_ID_HEVC, MKBETAG('h', 'v', 'c', '1') }, -+ { AV_CODEC_ID_AV1, MKBETAG('a', 'v', '0', '1') }, - { AV_CODEC_ID_NONE, 0 } - }; - -@@ -491,7 +493,8 @@ static void flv_write_codec_header(AVFormatContext* s, AVCodecParameters* par, i - FLVContext *flv = s->priv_data; - - if (par->codec_id == AV_CODEC_ID_AAC || par->codec_id == AV_CODEC_ID_H264 -- || par->codec_id == AV_CODEC_ID_MPEG4 || par->codec_id == AV_CODEC_ID_HEVC) { -+ || par->codec_id == AV_CODEC_ID_MPEG4 || par->codec_id == AV_CODEC_ID_HEVC -+ || par->codec_id == AV_CODEC_ID_AV1) { - int64_t pos; - avio_w8(pb, - par->codec_type == AVMEDIA_TYPE_VIDEO ? -@@ -537,6 +540,9 @@ static void flv_write_codec_header(AVFormatContext* s, AVCodecParameters* par, i - if (par->codec_id == AV_CODEC_ID_HEVC) { - avio_w8(pb, FLV_IS_EX_HEADER | PacketTypeSequenceStart); // ExVideoTagHeader mode with PacketTypeSequenceStart - avio_write(pb, "hvc1", 4); -+ } else if (par->codec_id == AV_CODEC_ID_AV1) { -+ avio_w8(pb, FLV_IS_EX_HEADER | PacketTypeSequenceStart); -+ avio_write(pb, "av01", 4); - } else { - avio_w8(pb, par->codec_tag | FLV_FRAME_KEY); // flags - avio_w8(pb, 0); // AVC sequence header -@@ -545,6 +551,8 @@ static void flv_write_codec_header(AVFormatContext* s, AVCodecParameters* par, i - - if (par->codec_id == AV_CODEC_ID_HEVC) - ff_isom_write_hvcc(pb, par->extradata, par->extradata_size, 0); -+ else if (par->codec_id == AV_CODEC_ID_AV1) -+ ff_isom_write_av1c(pb, par->extradata, par->extradata_size, 1); - else - ff_isom_write_avcc(pb, par->extradata, par->extradata_size); - } -@@ -843,13 +851,15 @@ static int flv_write_packet(AVFormatContext *s, AVPacket *pkt) - if (par->codec_id == AV_CODEC_ID_VP6F || par->codec_id == AV_CODEC_ID_VP6A || - par->codec_id == AV_CODEC_ID_VP6 || par->codec_id == AV_CODEC_ID_AAC) - flags_size = 2; -- else if (par->codec_id == AV_CODEC_ID_H264 || par->codec_id == AV_CODEC_ID_MPEG4 || par->codec_id == AV_CODEC_ID_HEVC) -+ else if (par->codec_id == AV_CODEC_ID_H264 || par->codec_id == AV_CODEC_ID_MPEG4 || -+ par->codec_id == AV_CODEC_ID_HEVC || par->codec_id == AV_CODEC_ID_AV1) - flags_size = 5; - else - flags_size = 1; - - if (par->codec_id == AV_CODEC_ID_AAC || par->codec_id == AV_CODEC_ID_H264 -- || par->codec_id == AV_CODEC_ID_MPEG4 || par->codec_id == AV_CODEC_ID_HEVC) { -+ || par->codec_id == AV_CODEC_ID_MPEG4 || par->codec_id == AV_CODEC_ID_HEVC -+ || par->codec_id == AV_CODEC_ID_AV1) { - size_t side_size; - uint8_t *side = av_packet_get_side_data(pkt, AV_PKT_DATA_NEW_EXTRADATA, &side_size); - if (side && side_size > 0 && (side_size != par->extradata_size || memcmp(side, par->extradata, side_size))) { -@@ -869,7 +879,8 @@ static int flv_write_packet(AVFormatContext *s, AVPacket *pkt) - "Packets are not in the proper order with respect to DTS\n"); - return AVERROR(EINVAL); - } -- if (par->codec_id == AV_CODEC_ID_H264 || par->codec_id == AV_CODEC_ID_MPEG4 || par->codec_id == AV_CODEC_ID_HEVC) { -+ if (par->codec_id == AV_CODEC_ID_H264 || par->codec_id == AV_CODEC_ID_MPEG4 || -+ par->codec_id == AV_CODEC_ID_HEVC || par->codec_id == AV_CODEC_ID_AV1) { - if (pkt->pts == AV_NOPTS_VALUE) { - av_log(s, AV_LOG_ERROR, "Packet is missing PTS\n"); - return AVERROR(EINVAL); -@@ -982,6 +993,9 @@ static int flv_write_packet(AVFormatContext *s, AVPacket *pkt) - if (par->codec_id == AV_CODEC_ID_HEVC) { - avio_w8(pb, FLV_IS_EX_HEADER | PacketTypeCodedFramesX); // ExVideoTagHeader mode with PacketTypeCodedFramesX - avio_write(pb, "hvc1", 4); -+ } else if (par->codec_id == AV_CODEC_ID_AV1) { -+ avio_w8(pb, FLV_IS_EX_HEADER | PacketTypeCodedFrames); -+ avio_write(pb, "av01", 4); - } else { - avio_w8(pb, flags); - } - -From patchwork Mon May 15 08:31:59 2023 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -X-Patchwork-Submitter: Steven Liu -X-Patchwork-Id: 41618 -Delivered-To: ffmpegpatchwork2@gmail.com -Received: by 2002:a05:6a20:ba91:b0:105:feb:71f2 with SMTP id - fb17csp1444290pzb; - Mon, 15 May 2023 01:33:41 -0700 (PDT) -X-Google-Smtp-Source: - ACHHUZ7k5HSYVpKlutDCH3BVN03oQ1eQ9NWjKwBebLGv5fK0d2qVGGgCtBo3XdEGlDTDUuvlDzRX -X-Received: by 2002:a17:907:9347:b0:94f:322d:909c with SMTP id - bv7-20020a170907934700b0094f322d909cmr26994118ejc.34.1684139620986; - Mon, 15 May 2023 01:33:40 -0700 (PDT) -ARC-Seal: i=1; a=rsa-sha256; t=1684139620; cv=none; - d=google.com; s=arc-20160816; - b=BBSgegXR1u0K767R9MAxQddt49hZNhDS+YgCHGYo0B07ClteK018739TK9tupVh7pK - wuvk/gzkEpIZpf2I3LQnpaxvQx0ZnllSKyz+x+560wEVKkQw5tlwpgr4qA3m0ApBBmQR - 2ZUu6WRpBnVeXJbT5n+ymITrLd1NVXLNPqoz7kL0iDML0b2iC9PqCoGRTHF6zJZFtCH2 - ZYUq4OdcbflvqqLBvKvSgEwuVof0bqDwD8kfq9noKTf7wrx5bcdIbq6XMYG1n6AnPq7R - R+ekmhosFoZ7IgohAkj9k8j6l4ipCc6yVN2M8TN1TfTwRC01vzz+SRYOXZWLNb0eqZzh - Zp2A== -ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; - s=arc-20160816; - h=sender:errors-to:content-transfer-encoding:cc:reply-to - :list-subscribe:list-help:list-post:list-archive:list-unsubscribe - :list-id:precedence:subject:feedback-id:mime-version:references - :in-reply-to:message-id:date:to:from:delivered-to; - bh=J5hIt8/6l7983HWQOAGA1qy6mjWmMWu6DJ2RZRfJeuQ=; - b=rX88kWHJtUiqnNutEQCOwUvfl5lV/FVHviaDHIsiatvB92XG71pgeFVXopTjJ+st3F - lu+/rKnYKAVXFqF4WHMP6bu0VT5bFE2A9806gTD5Rf1D2yGVjKWRH8fhY6Jl2KhEhQA+ - Efc6fMZ2qZRmdx5S2INE2k+sY3zgWZsFkv2NDowFLnjnpmTGneVW82ybCbL06DRH7Jts - wxWDfFfTqnp2VNwD0C462f5ogLB8cH7f9uoFviTovEYcXc8iLpHP38cJa3hdAuJg972S - cgjJSuZUaQ38bqmw7th2MDkaFSzryck0wafneRdJUxyKG7ltbwk4hgAz89yzUB7nZeU6 - yucA== -ARC-Authentication-Results: i=1; mx.google.com; - spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org - designates 79.124.17.100 as permitted sender) - smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org -Return-Path: -Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) - by mx.google.com with ESMTP id - gv41-20020a1709072be900b00965f171543esi11575148ejc.148.2023.05.15.01.33.40; - Mon, 15 May 2023 01:33:40 -0700 (PDT) -Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org - designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; -Authentication-Results: mx.google.com; - spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org - designates 79.124.17.100 as permitted sender) - smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org -Received: from [127.0.1.1] (localhost [127.0.0.1]) - by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id D65AD68C0A8; - Mon, 15 May 2023 11:33:29 +0300 (EEST) -X-Original-To: ffmpeg-devel@ffmpeg.org -Delivered-To: ffmpeg-devel@ffmpeg.org -Received: from bg4.exmail.qq.com (bg4.exmail.qq.com [43.155.67.158]) - by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 5AA6768C09F - for ; Mon, 15 May 2023 11:33:22 +0300 (EEST) -X-QQ-mid: bizesmtp75t1684139596t4okf86m -Received: from localhost ( [103.102.203.204]) by bizesmtp.qq.com (ESMTP) with - id ; Mon, 15 May 2023 16:33:15 +0800 (CST) -X-QQ-SSF: 01100000000000Z0Z000000A0000000 -X-QQ-FEAT: KvvwR/hcPA3wY6H84uX1Z4OhW9I2bQ1QV35znBz44h8GZ/oUuMaFpDcrT3dSg - MUkTVTMEyhXhHNx2JIMxfw5+q/3TCUtvnKXsxLZtQsy/0Nq/y+p0xVsHJzQmM8CvbT6L6Q3 - OmxwvGAO6ljvI/iA+SXU+3+HUNyetDE8UTRW1ZGCtG9iJRbK9wXPoiAMzLepT2+CHGO2brq - CwH6RA/e9/I4xOHLleywtC4oDlPuyHovxzzedsBTrXYic5tb0+D65abc6NjfHr7zrYD/DQu - HY0NNweX9YP/jE8jJ0TPLhcx7wighw+KDFbYf+UcUuaPHhzfAZh2f6aplibzVuvV78OPq2S - thQ/XeMGf/W9C/Oy4Eq145+G+pUQ7zx/OKY8Jj/33dmvwZkUr8= -X-QQ-GoodBg: 0 -X-BIZMAIL-ID: 9530387995930120932 -From: Steven Liu -To: ffmpeg-devel@ffmpeg.org -Date: Mon, 15 May 2023 16:31:59 +0800 -Message-Id: <20230515083201.48201-5-lq@chinaffmpeg.org> -X-Mailer: git-send-email 2.40.0 -In-Reply-To: <20230515083201.48201-1-lq@chinaffmpeg.org> -References: - - <20230515083201.48201-1-lq@chinaffmpeg.org> -MIME-Version: 1.0 -X-QQ-SENDSIZE: 520 -Feedback-ID: bizesmtp:chinaffmpeg.org:qybglogicsvrsz:qybglogicsvrsz3a-3 -Subject: [FFmpeg-devel] [PATCH v10 4/6] avformat/flvdec: support demux av1 - in enhanced flv -X-BeenThere: ffmpeg-devel@ffmpeg.org -X-Mailman-Version: 2.1.29 -Precedence: list -List-Id: FFmpeg development discussions and patches -List-Unsubscribe: , - -List-Archive: -List-Post: -List-Help: -List-Subscribe: , - -Reply-To: FFmpeg development discussions and patches -Cc: Steven Liu -Errors-To: ffmpeg-devel-bounces@ffmpeg.org -Sender: "ffmpeg-devel" -X-TUID: MKqjViniwIy+ - -Signed-off-by: Steven Liu ---- - libavformat/flvdec.c | 12 ++++++++++-- - 1 file changed, 10 insertions(+), 2 deletions(-) - -diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c -index c8e6cadf1c..a0362ff11c 100644 ---- a/libavformat/flvdec.c -+++ b/libavformat/flvdec.c -@@ -318,6 +318,8 @@ static int flv_same_video_codec(AVFormatContext *s, AVCodecParameters *vpar, int - switch(codec_id) { - case MKBETAG('h', 'v', 'c', '1'): - return vpar->codec_id == AV_CODEC_ID_HEVC; -+ case MKBETAG('a', 'v', '0', '1'): -+ return vpar->codec_id == AV_CODEC_ID_AV1; - default: - break; - } -@@ -359,6 +361,10 @@ static int flv_set_video_codec(AVFormatContext *s, AVStream *vstream, - par->codec_id = AV_CODEC_ID_HEVC; - vstreami->need_parsing = AVSTREAM_PARSE_HEADERS; - return 4; -+ case MKBETAG('a', 'v', '0', '1'): -+ par->codec_id = AV_CODEC_ID_AV1; -+ vstreami->need_parsing = AVSTREAM_PARSE_HEADERS; -+ return 4; - default: - break; - } -@@ -1278,7 +1284,8 @@ retry_duration: - if (st->codecpar->codec_id == AV_CODEC_ID_AAC || - st->codecpar->codec_id == AV_CODEC_ID_H264 || - st->codecpar->codec_id == AV_CODEC_ID_MPEG4 || -- st->codecpar->codec_id == AV_CODEC_ID_HEVC) { -+ st->codecpar->codec_id == AV_CODEC_ID_HEVC || -+ st->codecpar->codec_id == AV_CODEC_ID_AV1) { - int type = 0; - if (flv->exheader && stream_type == FLV_STREAM_TYPE_VIDEO) { - type = flags & 0x0F; -@@ -1309,7 +1316,8 @@ retry_duration: - } - } - if (type == 0 && (!st->codecpar->extradata || st->codecpar->codec_id == AV_CODEC_ID_AAC || -- st->codecpar->codec_id == AV_CODEC_ID_H264 || st->codecpar->codec_id == AV_CODEC_ID_HEVC)) { -+ st->codecpar->codec_id == AV_CODEC_ID_H264 || st->codecpar->codec_id == AV_CODEC_ID_HEVC || -+ st->codecpar->codec_id == AV_CODEC_ID_AV1)) { - AVDictionaryEntry *t; - - if (st->codecpar->extradata) { - -From patchwork Mon May 15 08:32:00 2023 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -X-Patchwork-Submitter: Steven Liu -X-Patchwork-Id: 41619 -Delivered-To: ffmpegpatchwork2@gmail.com -Received: by 2002:a05:6a20:ba91:b0:105:feb:71f2 with SMTP id - fb17csp1444532pzb; - Mon, 15 May 2023 01:34:10 -0700 (PDT) -X-Google-Smtp-Source: - ACHHUZ4QlFqXMa0WNHK3Z3HLgPm2UskuQZX2wmbFhYm+ZL0BsDRPhLxJboG0YhDPFi999aVCQZE+ -X-Received: by 2002:a05:6402:14c3:b0:50d:fcfb:8633 with SMTP id - f3-20020a05640214c300b0050dfcfb8633mr9613789edx.9.1684139650196; - Mon, 15 May 2023 01:34:10 -0700 (PDT) -ARC-Seal: i=1; a=rsa-sha256; t=1684139650; cv=none; - d=google.com; s=arc-20160816; - b=sjfm4xhTPqjGNyHlxS3/kMPilx13EB+7S0YxjOI5lR9MMg8Sy3KgL187C6tuZqUwoZ - dJo7A3q41EK4WJyWTTUyqUOr8q8JPjbBTCJpVsERuMuMWpHrhQxvwEDibvfuDI0ZI2vK - y5pqRZ23OMNZLCC+fsc85gQDKPgvkYZTYisSOsWVRiZQGl04TipfZE1Uza8R7ZEXRgdH - ZW770YcfzVXmKKzralH4thSFhGfMZRpX7kj6oBtmpUco4Z6iu42o3iBTcaioGBzdWdPY - KL94WAIaMnCyO1JJaUAJGzEcQTGhPbXUzG7JvmqEwSa168GBSEjQJ3qJc8oOr+UVWcvn - HvaQ== -ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; - s=arc-20160816; - h=sender:errors-to:content-transfer-encoding:cc:reply-to - :list-subscribe:list-help:list-post:list-archive:list-unsubscribe - :list-id:precedence:subject:feedback-id:mime-version:references - :in-reply-to:message-id:date:to:from:delivered-to; - bh=b1Sp5oqZAMwakI7a3Zvw4MdnKPyomZo8cXqDnyJamjg=; - b=jcFJOli16NPqGPnMDcJVER3TEkWreNJ2Vu7711GhJhFkmXLNFhS2FUAoT9QBTy+JWm - jxaBjiVvs1MMQ+a3k3yT7AzVSUMMDDSagiE/jWzQ+vBN9dr/jQOMtJWxwfm4oTbBc0/r - GcHTgPKB2HvEiLOWaJ4CSfZcYBvosoew/IfPgKm06P2Btmc+faSXLCZ63nKEVTq7NCpx - qllJPkFmvlwB/+soxN7nZgTzXm/uurSOBMajImRGPOZUOZQE1I5Tk8OtJXZP6QtlSvXT - ZcglewhTYuHlAXbpT4sYyddMwKg9yPu6/Wmrol/wg3QpXPZ0lVtLeTozus/2UTISJrR5 - Lp3Q== -ARC-Authentication-Results: i=1; mx.google.com; - spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org - designates 79.124.17.100 as permitted sender) - smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org -Return-Path: -Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) - by mx.google.com with ESMTP id - f25-20020a056402151900b0050bd37278d9si11856925edw.435.2023.05.15.01.34.09; - Mon, 15 May 2023 01:34:10 -0700 (PDT) -Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org - designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; -Authentication-Results: mx.google.com; - spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org - designates 79.124.17.100 as permitted sender) - smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org -Received: from [127.0.1.1] (localhost [127.0.0.1]) - by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 0DB6568C092; - Mon, 15 May 2023 11:34:07 +0300 (EEST) -X-Original-To: ffmpeg-devel@ffmpeg.org -Delivered-To: ffmpeg-devel@ffmpeg.org -Received: from bg4.exmail.qq.com (bg4.exmail.qq.com [43.154.221.58]) - by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 96A14680274 - for ; Mon, 15 May 2023 11:33:59 +0300 (EEST) -X-QQ-mid: bizesmtp76t1684139634tg83beu0 -Received: from localhost ( [103.102.203.204]) by bizesmtp.qq.com (ESMTP) with - id ; Mon, 15 May 2023 16:33:52 +0800 (CST) -X-QQ-SSF: 01100000000000Z0Z000000A0000000 -X-QQ-FEAT: DWSCcwW/aQb83U5Bq9N00w3kkIuofNiUvlQbgR0sgGjFEas+vh7wXyRycFT/z - w33SH7uNRX8lmP+8+iy6jQH/gsaQRVAau2z8K0utdx9GuZMvY0e5SZfB0zBfncb1NdBZJxB - Ptvibavnj2rDlqrGLO9dvFEfmYj1K48HYp6rdjCb+xRPfyOtnct3Zq6ST7F1DxU1+Kmt8cw - 2qVgeA79DNHm1JbcDzi/2W/SpzWHWk/jamN4cAQfKyP9B4AvMPaFd8kdl6akYbR0Q84H73M - Pcx8UXz6iw4sCTSPFzf0zrsI4+shly9KFp4UESTfRbDEJ46pcyw8+6Uz+Q7w+7CRtPlOsms - K6IAbcLwicf/v8Rm2nHdrNPotcaMgY5p7IqmkY/Y/b2feqKiAM= -X-QQ-GoodBg: 0 -X-BIZMAIL-ID: 4611718483056789364 -From: Steven Liu -To: ffmpeg-devel@ffmpeg.org -Date: Mon, 15 May 2023 16:32:00 +0800 -Message-Id: <20230515083201.48201-6-lq@chinaffmpeg.org> -X-Mailer: git-send-email 2.40.0 -In-Reply-To: <20230515083201.48201-1-lq@chinaffmpeg.org> -References: - - <20230515083201.48201-1-lq@chinaffmpeg.org> -MIME-Version: 1.0 -X-QQ-SENDSIZE: 520 -Feedback-ID: bizesmtp:chinaffmpeg.org:qybglogicsvrsz:qybglogicsvrsz3a-3 -Subject: [FFmpeg-devel] [PATCH v10 5/6] avformat/flvenc: support mux vp9 in - enhanced flv -X-BeenThere: ffmpeg-devel@ffmpeg.org -X-Mailman-Version: 2.1.29 -Precedence: list -List-Id: FFmpeg development discussions and patches -List-Unsubscribe: , - -List-Archive: -List-Post: -List-Help: -List-Subscribe: , - -Reply-To: FFmpeg development discussions and patches -Cc: Steven Liu -Errors-To: ffmpeg-devel-bounces@ffmpeg.org -Sender: "ffmpeg-devel" -X-TUID: appcyLUJeeFW - -Signed-off-by: Steven Liu ---- - libavformat/Makefile | 2 +- - libavformat/flvenc.c | 22 ++++++++++++++-------- - 2 files changed, 15 insertions(+), 9 deletions(-) - -diff --git a/libavformat/Makefile b/libavformat/Makefile -index c868e1626c..16cfe107ea 100644 ---- a/libavformat/Makefile -+++ b/libavformat/Makefile -@@ -214,7 +214,7 @@ OBJS-$(CONFIG_FLAC_MUXER) += flacenc.o flacenc_header.o \ - OBJS-$(CONFIG_FLIC_DEMUXER) += flic.o - OBJS-$(CONFIG_FLV_DEMUXER) += flvdec.o - OBJS-$(CONFIG_LIVE_FLV_DEMUXER) += flvdec.o --OBJS-$(CONFIG_FLV_MUXER) += flvenc.o avc.o hevc.o av1.o -+OBJS-$(CONFIG_FLV_MUXER) += flvenc.o avc.o hevc.o av1.o vpcc.o - OBJS-$(CONFIG_FOURXM_DEMUXER) += 4xm.o - OBJS-$(CONFIG_FRAMECRC_MUXER) += framecrcenc.o framehash.o - OBJS-$(CONFIG_FRAMEHASH_MUXER) += hashenc.o framehash.o -diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c -index c1784b332d..475dd0bf44 100644 ---- a/libavformat/flvenc.c -+++ b/libavformat/flvenc.c -@@ -29,6 +29,7 @@ - #include "avio.h" - #include "avc.h" - #include "av1.h" -+#include "vpcc.h" - #include "hevc.h" - #include "avformat.h" - #include "flv.h" -@@ -50,6 +51,7 @@ static const AVCodecTag flv_video_codec_ids[] = { - { AV_CODEC_ID_H264, FLV_CODECID_H264 }, - { AV_CODEC_ID_HEVC, MKBETAG('h', 'v', 'c', '1') }, - { AV_CODEC_ID_AV1, MKBETAG('a', 'v', '0', '1') }, -+ { AV_CODEC_ID_VP9, MKBETAG('v', 'p', '0', '9') }, - { AV_CODEC_ID_NONE, 0 } - }; - -@@ -494,7 +496,7 @@ static void flv_write_codec_header(AVFormatContext* s, AVCodecParameters* par, i - - if (par->codec_id == AV_CODEC_ID_AAC || par->codec_id == AV_CODEC_ID_H264 - || par->codec_id == AV_CODEC_ID_MPEG4 || par->codec_id == AV_CODEC_ID_HEVC -- || par->codec_id == AV_CODEC_ID_AV1) { -+ || par->codec_id == AV_CODEC_ID_AV1 || par->codec_id == AV_CODEC_ID_VP9) { - int64_t pos; - avio_w8(pb, - par->codec_type == AVMEDIA_TYPE_VIDEO ? -@@ -540,9 +542,9 @@ static void flv_write_codec_header(AVFormatContext* s, AVCodecParameters* par, i - if (par->codec_id == AV_CODEC_ID_HEVC) { - avio_w8(pb, FLV_IS_EX_HEADER | PacketTypeSequenceStart); // ExVideoTagHeader mode with PacketTypeSequenceStart - avio_write(pb, "hvc1", 4); -- } else if (par->codec_id == AV_CODEC_ID_AV1) { -+ } else if (par->codec_id == AV_CODEC_ID_AV1 || par->codec_id == AV_CODEC_ID_VP9) { - avio_w8(pb, FLV_IS_EX_HEADER | PacketTypeSequenceStart); -- avio_write(pb, "av01", 4); -+ avio_write(pb, par->codec_id == AV_CODEC_ID_AV1 ? "av01" : "vp09", 4); - } else { - avio_w8(pb, par->codec_tag | FLV_FRAME_KEY); // flags - avio_w8(pb, 0); // AVC sequence header -@@ -553,6 +555,8 @@ static void flv_write_codec_header(AVFormatContext* s, AVCodecParameters* par, i - ff_isom_write_hvcc(pb, par->extradata, par->extradata_size, 0); - else if (par->codec_id == AV_CODEC_ID_AV1) - ff_isom_write_av1c(pb, par->extradata, par->extradata_size, 1); -+ else if (par->codec_id == AV_CODEC_ID_VP9) -+ ff_isom_write_vpcc(s, pb, par->extradata, par->extradata_size, par); - else - ff_isom_write_avcc(pb, par->extradata, par->extradata_size); - } -@@ -852,14 +856,15 @@ static int flv_write_packet(AVFormatContext *s, AVPacket *pkt) - par->codec_id == AV_CODEC_ID_VP6 || par->codec_id == AV_CODEC_ID_AAC) - flags_size = 2; - else if (par->codec_id == AV_CODEC_ID_H264 || par->codec_id == AV_CODEC_ID_MPEG4 || -- par->codec_id == AV_CODEC_ID_HEVC || par->codec_id == AV_CODEC_ID_AV1) -+ par->codec_id == AV_CODEC_ID_HEVC || par->codec_id == AV_CODEC_ID_AV1 || -+ par->codec_id == AV_CODEC_ID_VP9) - flags_size = 5; - else - flags_size = 1; - - if (par->codec_id == AV_CODEC_ID_AAC || par->codec_id == AV_CODEC_ID_H264 - || par->codec_id == AV_CODEC_ID_MPEG4 || par->codec_id == AV_CODEC_ID_HEVC -- || par->codec_id == AV_CODEC_ID_AV1) { -+ || par->codec_id == AV_CODEC_ID_AV1 || par->codec_id == AV_CODEC_ID_VP9) { - size_t side_size; - uint8_t *side = av_packet_get_side_data(pkt, AV_PKT_DATA_NEW_EXTRADATA, &side_size); - if (side && side_size > 0 && (side_size != par->extradata_size || memcmp(side, par->extradata, side_size))) { -@@ -880,7 +885,8 @@ static int flv_write_packet(AVFormatContext *s, AVPacket *pkt) - return AVERROR(EINVAL); - } - if (par->codec_id == AV_CODEC_ID_H264 || par->codec_id == AV_CODEC_ID_MPEG4 || -- par->codec_id == AV_CODEC_ID_HEVC || par->codec_id == AV_CODEC_ID_AV1) { -+ par->codec_id == AV_CODEC_ID_HEVC || par->codec_id == AV_CODEC_ID_AV1 || -+ par->codec_id == AV_CODEC_ID_VP9) { - if (pkt->pts == AV_NOPTS_VALUE) { - av_log(s, AV_LOG_ERROR, "Packet is missing PTS\n"); - return AVERROR(EINVAL); -@@ -993,9 +999,9 @@ static int flv_write_packet(AVFormatContext *s, AVPacket *pkt) - if (par->codec_id == AV_CODEC_ID_HEVC) { - avio_w8(pb, FLV_IS_EX_HEADER | PacketTypeCodedFramesX); // ExVideoTagHeader mode with PacketTypeCodedFramesX - avio_write(pb, "hvc1", 4); -- } else if (par->codec_id == AV_CODEC_ID_AV1) { -+ } else if (par->codec_id == AV_CODEC_ID_AV1 || par->codec_id == AV_CODEC_ID_VP9) { - avio_w8(pb, FLV_IS_EX_HEADER | PacketTypeCodedFrames); -- avio_write(pb, "av01", 4); -+ avio_write(pb, par->codec_id == AV_CODEC_ID_AV1 ? "av01" : "vp09", 4); - } else { - avio_w8(pb, flags); - } - -From patchwork Mon May 15 08:32:01 2023 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -X-Patchwork-Submitter: Steven Liu -X-Patchwork-Id: 41620 -Delivered-To: ffmpegpatchwork2@gmail.com -Received: by 2002:a05:6a20:ba91:b0:105:feb:71f2 with SMTP id - fb17csp1444616pzb; - Mon, 15 May 2023 01:34:19 -0700 (PDT) -X-Google-Smtp-Source: - ACHHUZ4K6eOJwwn7jPfy0dhTP4IQr2XzDB8PfB7Er6aQtrCrxnddiRIgdBqZB72dHhyqfbILXd5E -X-Received: by 2002:a17:906:ee8e:b0:95e:c549:9ace with SMTP id - wt14-20020a170906ee8e00b0095ec5499acemr28082182ejb.62.1684139659496; - Mon, 15 May 2023 01:34:19 -0700 (PDT) -ARC-Seal: i=1; a=rsa-sha256; t=1684139659; cv=none; - d=google.com; s=arc-20160816; - b=FM9SQbkYmqWaOAa8YRKsdoj3BSoNN/SsDqXgEaRL8lCygJuahCT1ybocV1IqmUSTxS - l5AcUJGbZbl2BeNhK5mX43aCfKBSSF3DLhmRCMBC8pU2iPmv7TuSV58kRfLY6r83j8Ic - dV56QUYYtN+Ve0BWnaHFOzivSNAgHxwePstQL043LHD2rn+B5CyNvq7l2CahnhMJ8JUG - zJNSBe/LFF0Lhkymqd877vkJ+x+UjSWEIdomIJdAcAt2D06jDxwIF/nnLDDHmvQeny2N - 8xqssE401QcYCq6GtRi0UTAyMrYiDU4RUPOh8Kjb5YoMXYpbI+BCsr6VJlh6/F6cFD58 - YStw== -ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; - s=arc-20160816; - h=sender:errors-to:content-transfer-encoding:cc:reply-to - :list-subscribe:list-help:list-post:list-archive:list-unsubscribe - :list-id:precedence:subject:feedback-id:mime-version:references - :in-reply-to:message-id:date:to:from:delivered-to; - bh=JCKfqtynP85UyN4OG5PQuC2GOM45EC75rPa/TN9Pkis=; - b=MF78hg+0KkjUNq5Bjz6b4rjcJDJqrFufWHhDWzKgWCGo15fvnVg3UY8PDvpsUYxxSA - SXQJP1urvuxLvJ9m6N20/mBCgrN9Cqca537oiWWNbayAOBLuihXPNDPZLqYgD9yg+03U - Qo46rKs8BxkuzTKsqfFu1cf8b3qgqp2wt2mOFFnRU8p9J5foA5HCpHoEB1SWo8KqKjqz - NeFoyh4k/CHk8Qy2rhQ/ahuNo0zByXEVuGqBEK1GakW8bC6DpX/gX9PnsE7BvpOrO/+z - iEJxUd1RyUFDRETjdcqfLeRlEBO0NbFi9GTRjg0oY7m2OM8gh9zw7TIOoKfKaCVepa+1 - zs+g== -ARC-Authentication-Results: i=1; mx.google.com; - spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org - designates 79.124.17.100 as permitted sender) - smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org -Return-Path: -Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) - by mx.google.com with ESMTP id - f21-20020a170906825500b00965c55c71d9si10492876ejx.988.2023.05.15.01.34.19; - Mon, 15 May 2023 01:34:19 -0700 (PDT) -Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org - designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; -Authentication-Results: mx.google.com; - spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org - designates 79.124.17.100 as permitted sender) - smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org -Received: from [127.0.1.1] (localhost [127.0.0.1]) - by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 3486468C072; - Mon, 15 May 2023 11:34:13 +0300 (EEST) -X-Original-To: ffmpeg-devel@ffmpeg.org -Delivered-To: ffmpeg-devel@ffmpeg.org -Received: from bg4.exmail.qq.com (bg4.exmail.qq.com [43.154.221.58]) - by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 6482B68C0A0 - for ; Mon, 15 May 2023 11:34:05 +0300 (EEST) -X-QQ-mid: bizesmtp71t1684139639tsfp6osq -Received: from localhost ( [103.102.203.204]) by bizesmtp.qq.com (ESMTP) with - id ; Mon, 15 May 2023 16:33:58 +0800 (CST) -X-QQ-SSF: 01100000000000Z0Z000000A0000000 -X-QQ-FEAT: v2TBAhtyi5HmOI8RH62YXWVaml0uNXxcsJwtXrqVzXdpJwJpkYcpKS0jOn5b8 - vputCYK1FNClBNOmv9AzELjT/K26cFOsUYKBpAudrf8Al/Kmwl8CjyT6nDK06QByrHu67A4 - sX8VQrazIXO6ZPIrfA9ElusXtssmR22e8ju0nXX7oNy/AS4t0bZkuJRVmYCoHSCnLqnvF9r - YboVdmg0ZbLovrXBy26bgQr944G/tQRTeAGorAwE61Lf9tqlRKuT8TO8/BA/V7zBuaZTSxA - nghl61awPoduY4vd9Nepw43V2Cun4wfPTvAMJn9EQhrdUge4sIN0Q4EuWkBd9dC/nTOwVKV - WsjLxbyL6apFe08XmyeS9MDJkL+bFN3ykpDJqblBg8C1AYOjVyYFS2Yt/atcQ== -X-QQ-GoodBg: 0 -X-BIZMAIL-ID: 14221595051603022987 -From: Steven Liu -To: ffmpeg-devel@ffmpeg.org -Date: Mon, 15 May 2023 16:32:01 +0800 -Message-Id: <20230515083201.48201-7-lq@chinaffmpeg.org> -X-Mailer: git-send-email 2.40.0 -In-Reply-To: <20230515083201.48201-1-lq@chinaffmpeg.org> -References: - - <20230515083201.48201-1-lq@chinaffmpeg.org> -MIME-Version: 1.0 -X-QQ-SENDSIZE: 520 -Feedback-ID: bizesmtp:chinaffmpeg.org:qybglogicsvrsz:qybglogicsvrsz3a-3 -Subject: [FFmpeg-devel] [PATCH v10 6/6] avformat/flvdec: support demux vp9 - in enhanced flv -X-BeenThere: ffmpeg-devel@ffmpeg.org -X-Mailman-Version: 2.1.29 -Precedence: list -List-Id: FFmpeg development discussions and patches -List-Unsubscribe: , - -List-Archive: -List-Post: -List-Help: -List-Subscribe: , - -Reply-To: FFmpeg development discussions and patches -Cc: Steven Liu -Errors-To: ffmpeg-devel-bounces@ffmpeg.org -Sender: "ffmpeg-devel" -X-TUID: wOtvTzk+zhdw - -Signed-off-by: Steven Liu ---- - libavformat/flvdec.c | 11 +++++++++-- - 1 file changed, 9 insertions(+), 2 deletions(-) - -diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c -index a0362ff11c..a6a94a4021 100644 ---- a/libavformat/flvdec.c -+++ b/libavformat/flvdec.c -@@ -320,6 +320,8 @@ static int flv_same_video_codec(AVFormatContext *s, AVCodecParameters *vpar, int - return vpar->codec_id == AV_CODEC_ID_HEVC; - case MKBETAG('a', 'v', '0', '1'): - return vpar->codec_id == AV_CODEC_ID_AV1; -+ case MKBETAG('v', 'p', '0', '9'): -+ return vpar->codec_id == AV_CODEC_ID_VP9; - default: - break; - } -@@ -365,6 +367,10 @@ static int flv_set_video_codec(AVFormatContext *s, AVStream *vstream, - par->codec_id = AV_CODEC_ID_AV1; - vstreami->need_parsing = AVSTREAM_PARSE_HEADERS; - return 4; -+ case MKBETAG('v', 'p', '0', '9'): -+ par->codec_id = AV_CODEC_ID_VP9; -+ vstreami->need_parsing = AVSTREAM_PARSE_HEADERS; -+ return 4; - default: - break; - } -@@ -1285,7 +1291,8 @@ retry_duration: - st->codecpar->codec_id == AV_CODEC_ID_H264 || - st->codecpar->codec_id == AV_CODEC_ID_MPEG4 || - st->codecpar->codec_id == AV_CODEC_ID_HEVC || -- st->codecpar->codec_id == AV_CODEC_ID_AV1) { -+ st->codecpar->codec_id == AV_CODEC_ID_AV1 || -+ st->codecpar->codec_id == AV_CODEC_ID_VP9) { - int type = 0; - if (flv->exheader && stream_type == FLV_STREAM_TYPE_VIDEO) { - type = flags & 0x0F; -@@ -1317,7 +1324,7 @@ retry_duration: - } - if (type == 0 && (!st->codecpar->extradata || st->codecpar->codec_id == AV_CODEC_ID_AAC || - st->codecpar->codec_id == AV_CODEC_ID_H264 || st->codecpar->codec_id == AV_CODEC_ID_HEVC || -- st->codecpar->codec_id == AV_CODEC_ID_AV1)) { -+ st->codecpar->codec_id == AV_CODEC_ID_AV1 || st->codecpar->codec_id == AV_CODEC_ID_VP9)) { - AVDictionaryEntry *t; - - if (st->codecpar->extradata) { diff --git a/ffmpeg-dlopen-openh264.patch b/ffmpeg-dlopen-openh264.patch index a283f85..329606b 100644 --- a/ffmpeg-dlopen-openh264.patch +++ b/ffmpeg-dlopen-openh264.patch @@ -1,7 +1,7 @@ -From 1f48740db0dda8d6ec1b97a7f4a794e381a65636 Mon Sep 17 00:00:00 2001 +From 3daa49cae0bfc3de434dd28c3a23ae877f0639db Mon Sep 17 00:00:00 2001 From: Neal Gompa -Date: Wed, 12 Oct 2022 09:41:27 -0400 -Subject: [PATCH] avcodec/openh264: Add the ability to dlopen() OpenH264 +Date: Thu, 4 Jan 2024 10:21:17 -0500 +Subject: [PATCH] lavc/openh264: Add the ability to dlopen() OpenH264 We can't directly depend on OpenH264, but we can weakly link to it and gracefully expose the capability. @@ -24,10 +24,10 @@ Signed-off-by: Neal Gompa create mode 100644 libavcodec/libopenh264_dlopen.h diff --git a/configure b/configure -index ba5793b2ff..8855c1a908 100755 +index 1f0b9497cb..97fa4a5d6a 100755 --- a/configure +++ b/configure -@@ -251,6 +251,7 @@ External library support: +@@ -249,6 +249,7 @@ External library support: --enable-libopencore-amrwb enable AMR-WB decoding via libopencore-amrwb [no] --enable-libopencv enable video filtering via libopencv [no] --enable-libopenh264 enable H.264 encoding via OpenH264 [no] @@ -35,7 +35,7 @@ index ba5793b2ff..8855c1a908 100755 --enable-libopenjpeg enable JPEG 2000 de/encoding via OpenJPEG [no] --enable-libopenmpt enable decoding tracked files via libopenmpt [no] --enable-libopenvino enable OpenVINO as a DNN module backend -@@ -1844,6 +1845,7 @@ EXTERNAL_LIBRARY_LIST=" +@@ -1871,6 +1872,7 @@ EXTERNAL_LIBRARY_LIST=" libmysofa libopencv libopenh264 @@ -43,7 +43,7 @@ index ba5793b2ff..8855c1a908 100755 libopenjpeg libopenmpt libopenvino -@@ -6596,6 +6598,7 @@ enabled libopencv && { check_headers opencv2/core/core_c.h && +@@ -6765,6 +6767,7 @@ enabled libopencv && { check_headers opencv2/core/core_c.h && require libopencv opencv2/core/core_c.h cvCreateImageHeader -lopencv_core -lopencv_imgproc; } || require_pkg_config libopencv opencv opencv/cxcore.h cvCreateImageHeader; } enabled libopenh264 && require_pkg_config libopenh264 openh264 wels/codec_api.h WelsGetCodecVersion @@ -52,17 +52,17 @@ index ba5793b2ff..8855c1a908 100755 { require_pkg_config libopenjpeg "libopenjp2 >= 2.1.0" openjpeg.h opj_version -DOPJ_STATIC && add_cppflags -DOPJ_STATIC; } } enabled libopenmpt && require_pkg_config libopenmpt "libopenmpt >= 0.2.6557" libopenmpt/libopenmpt.h openmpt_module_create -lstdc++ && append libopenmpt_extralibs "-lstdc++" diff --git a/libavcodec/Makefile b/libavcodec/Makefile -index 457ec58377..08a26fba5f 100644 +index 580a8d6b54..c27d229f6d 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile -@@ -1075,6 +1075,7 @@ OBJS-$(CONFIG_LIBMP3LAME_ENCODER) += libmp3lame.o +@@ -1115,6 +1115,7 @@ OBJS-$(CONFIG_LIBMP3LAME_ENCODER) += libmp3lame.o OBJS-$(CONFIG_LIBOPENCORE_AMRNB_DECODER) += libopencore-amr.o OBJS-$(CONFIG_LIBOPENCORE_AMRNB_ENCODER) += libopencore-amr.o OBJS-$(CONFIG_LIBOPENCORE_AMRWB_DECODER) += libopencore-amr.o +OBJS-$(CONFIG_LIBOPENH264_DLOPEN) += libopenh264_dlopen.o OBJS-$(CONFIG_LIBOPENH264_DECODER) += libopenh264dec.o libopenh264.o OBJS-$(CONFIG_LIBOPENH264_ENCODER) += libopenh264enc.o libopenh264.o - OBJS-$(CONFIG_LIBOPENJPEG_DECODER) += libopenjpegdec.o + OBJS-$(CONFIG_LIBOPENJPEG_ENCODER) += libopenjpegenc.o diff --git a/libavcodec/libopenh264.c b/libavcodec/libopenh264.c index c80c85ea8b..128c3d9846 100644 --- a/libavcodec/libopenh264.c @@ -299,7 +299,7 @@ index 0000000000..d7d8bb7cad + +#endif /* HAVE_LIBOPENH264_DLOPEN_H */ diff --git a/libavcodec/libopenh264dec.c b/libavcodec/libopenh264dec.c -index 7e14d4dd7d..a805598446 100644 +index b6a9bba2dc..e042189161 100644 --- a/libavcodec/libopenh264dec.c +++ b/libavcodec/libopenh264dec.c @@ -19,8 +19,12 @@ @@ -329,7 +329,7 @@ index 7e14d4dd7d..a805598446 100644 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 5257906567..80481f3d0a 100644 +index 6f231d22b2..3f0e990d80 100644 --- a/libavcodec/libopenh264enc.c +++ b/libavcodec/libopenh264enc.c @@ -19,8 +19,12 @@ @@ -359,5 +359,5 @@ index 5257906567..80481f3d0a 100644 av_log(avctx, AV_LOG_ERROR, "Unable to create encoder\n"); return AVERROR_UNKNOWN; -- -2.36.1 +2.43.0 diff --git a/ffmpeg-ge-av1-vaapi-encode-support.patch b/ffmpeg-ge-av1-vaapi-encode-support.patch deleted file mode 100644 index 6ae8258..0000000 --- a/ffmpeg-ge-av1-vaapi-encode-support.patch +++ /dev/null @@ -1,3984 +0,0 @@ -From 7c2ea45053b7a3d4193bb0abb9c0f3b0cdbeec7a Mon Sep 17 00:00:00 2001 -From: GloriousEggroll -Date: Thu, 9 Nov 2023 17:51:19 -0700 -Subject: [PATCH] backport av1 encode support - -Adapted from https://patchwork.ffmpeg.org/project/ffmpeg/list/?series=9594 - ---- - configure | 3 + - doc/encoders.texi | 14 + - libavcodec/Makefile | 2 + - libavcodec/allcodecs.c | 1 + - libavcodec/av1.h | 7 + - libavcodec/av1_levels.c | 92 +++ - libavcodec/av1_levels.h | 58 ++ - libavcodec/cbs.c | 155 +++-- - libavcodec/cbs.h | 88 ++- - libavcodec/cbs_av1.c | 262 +++----- - libavcodec/cbs_av1.h | 1 + - libavcodec/cbs_av1_syntax_template.c | 4 +- - libavcodec/cbs_bsf.c | 5 + - libavcodec/cbs_h2645.c | 149 ++--- - libavcodec/cbs_internal.h | 96 ++- - libavcodec/cbs_mpeg2.c | 15 +- - libavcodec/cbs_vp9.c | 122 ++-- - libavcodec/extract_extradata_bsf.c | 7 +- - libavcodec/trace_headers_bsf.c | 2 + - libavcodec/vaapi_encode.c | 370 ++++++++--- - libavcodec/vaapi_encode.h | 39 +- - libavcodec/vaapi_encode_av1.c | 949 +++++++++++++++++++++++++++ - libavcodec/vaapi_encode_h264.c | 94 +-- - libavcodec/vaapi_encode_h265.c | 76 ++- - libavcodec/vaapi_encode_mpeg2.c | 6 +- - libavcodec/vaapi_encode_vp8.c | 6 +- - libavcodec/vaapi_encode_vp9.c | 26 +- - 27 files changed, 2054 insertions(+), 595 deletions(-) - create mode 100644 libavcodec/av1_levels.c - create mode 100644 libavcodec/av1_levels.h - create mode 100644 libavcodec/vaapi_encode_av1.c - -diff --git a/configure b/configure -index b6616f0..f5a91b6 100755 ---- a/configure -+++ b/configure -@@ -3259,6 +3259,8 @@ av1_qsv_decoder_select="qsvdec" - av1_qsv_encoder_select="qsvenc" - av1_qsv_encoder_deps="libvpl" - av1_amf_encoder_deps="amf" -+av1_vaapi_encoder_deps="VAEncPictureParameterBufferAV1" -+av1_vaapi_encoder_select="cbs_av1 vaapi_encode" - - # parsers - aac_parser_select="adts_header mpeg4audio" -@@ -6973,6 +6975,7 @@ if enabled vaapi; then - check_type "va/va.h va/va_enc_jpeg.h" "VAEncPictureParameterBufferJPEG" - check_type "va/va.h va/va_enc_vp8.h" "VAEncPictureParameterBufferVP8" - check_type "va/va.h va/va_enc_vp9.h" "VAEncPictureParameterBufferVP9" -+ check_type "va/va.h va/va_enc_av1.h" "VAEncPictureParameterBufferAV1" - fi - - if enabled_all opencl libdrm ; then -diff --git a/doc/encoders.texi b/doc/encoders.texi -index b02737b..994e27f 100644 ---- a/doc/encoders.texi -+++ b/doc/encoders.texi -@@ -3965,6 +3965,20 @@ Average variable bitrate. - Each encoder also has its own specific options: - @table @option - -+@item av1_vaapi -+@option{profile} sets the value of @emph{seq_profile}. -+@option{tier} sets the value of @emph{seq_tier}. -+@option{level} sets the value of @emph{seq_level_idx}. -+ -+@table @option -+@item tiles -+Set the number of tiles to encode the input video with, as columns x rows. -+(default is auto, which means use minimal tile column/row number). -+@item tile_groups -+Set tile groups number. All the tiles will be distributed as evenly as possible to -+each tile group. (default is 1). -+@end table -+ - @item h264_vaapi - @option{profile} sets the value of @emph{profile_idc} and the @emph{constraint_set*_flag}s. - @option{level} sets the value of @emph{level_idc}. -diff --git a/libavcodec/Makefile b/libavcodec/Makefile -index 389253f..5f620e6 100644 ---- a/libavcodec/Makefile -+++ b/libavcodec/Makefile -@@ -255,6 +255,7 @@ OBJS-$(CONFIG_AV1_CUVID_DECODER) += cuviddec.o - OBJS-$(CONFIG_AV1_MEDIACODEC_DECODER) += mediacodecdec.o - OBJS-$(CONFIG_AV1_NVENC_ENCODER) += nvenc_av1.o nvenc.o - OBJS-$(CONFIG_AV1_QSV_ENCODER) += qsvenc_av1.o -+OBJS-$(CONFIG_AV1_VAAPI_ENCODER) += vaapi_encode_av1.o av1_levels.o - OBJS-$(CONFIG_AVRN_DECODER) += avrndec.o - OBJS-$(CONFIG_AVRP_DECODER) += r210dec.o - OBJS-$(CONFIG_AVRP_ENCODER) += r210enc.o -@@ -1298,6 +1299,7 @@ TESTPROGS = avcodec \ - jpeg2000dwt \ - mathops \ - -+TESTPROGS-$(CONFIG_AV1_VAAPI_ENCODER) += av1_levels - TESTPROGS-$(CONFIG_CABAC) += cabac - TESTPROGS-$(CONFIG_DCT) += avfft - TESTPROGS-$(CONFIG_FFT) += fft fft-fixed32 -diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c -index e593ad1..4706fc3 100644 ---- a/libavcodec/allcodecs.c -+++ b/libavcodec/allcodecs.c -@@ -838,6 +838,7 @@ extern const FFCodec ff_av1_nvenc_encoder; - extern const FFCodec ff_av1_qsv_decoder; - extern const FFCodec ff_av1_qsv_encoder; - extern const FFCodec ff_av1_amf_encoder; -+extern const FFCodec ff_av1_vaapi_encoder; - extern const FFCodec ff_libopenh264_encoder; - extern const FFCodec ff_libopenh264_decoder; - extern const FFCodec ff_h264_amf_encoder; -diff --git a/libavcodec/av1.h b/libavcodec/av1.h -index 384f7cd..8704bc4 100644 ---- a/libavcodec/av1.h -+++ b/libavcodec/av1.h -@@ -175,6 +175,13 @@ enum { - AV1_RESTORE_SWITCHABLE = 3, - }; - -+// TX mode (section 6.8.21) -+enum { -+ AV1_ONLY_4X4 = 0, -+ AV1_TX_MODE_LARGEST = 1, -+ AV1_TX_MODE_SELECT = 2, -+}; -+ - // Sequence Headers are actually unbounded because one can use - // an arbitrary number of leading zeroes when encoding via uvlc. - // The following estimate is based around using the lowest number -diff --git a/libavcodec/av1_levels.c b/libavcodec/av1_levels.c -new file mode 100644 -index 0000000..19b6ee1 ---- /dev/null -+++ b/libavcodec/av1_levels.c -@@ -0,0 +1,92 @@ -+/* -+ * Copyright (c) 2023 Intel Corporation -+ * -+ * This file is part of FFmpeg. -+ * -+ * FFmpeg is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License as published by the Free Software Foundation; either -+ * version 2.1 of the License, or (at your option) any later version. -+ * -+ * FFmpeg is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with FFmpeg; if not, write to the Free Software -+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -+ */ -+ -+#include -+#include "libavutil/macros.h" -+#include "av1_levels.h" -+ -+/** ignore entries which named in spec but no details. Like level 2.2 and 7.0. */ -+static const AV1LevelDescriptor av1_levels[] = { -+ // Name MaxVSize MainMbps MaxTiles -+ // | level_idx | MaxDisplayRate | HighMbps | MaxTileCols -+ // | | MaxPicSize | | MaxDecodeRate | | MainCR | | -+ // | | | MaxHSize | | | MaxHeaderRate | | | HighCR| | -+ // | | | | | | | | | | | | | | -+ { "2.0", 0, 147456, 2048, 1152, 4423680, 5529600, 150, 1.5, 0, 2, 0, 8, 4 }, -+ { "2.1", 1, 278784, 2816, 1584, 8363520, 10454400, 150, 3.0, 0, 2, 0, 8, 4 }, -+ { "3.0", 4, 665856, 4352, 2448, 19975680, 24969600, 150, 6.0, 0, 2, 0, 16, 6 }, -+ { "3.1", 5, 1065024, 5504, 3096, 31950720, 39938400, 150, 10.0, 0, 2, 0, 16, 6 }, -+ { "4.0", 8, 2359296, 6144, 3456, 70778880, 77856768, 300, 12.0, 30.0, 4, 4, 32, 8 }, -+ { "4.1", 9, 2359296, 6144, 3456, 141557760, 155713536, 300, 20.0, 50.0, 4, 4, 32, 8 }, -+ { "5.0", 12, 8912896, 8192, 4352, 267386880, 273715200, 300, 30.0, 100.0, 6, 4, 64, 8 }, -+ { "5.1", 13, 8912896, 8192, 4352, 534773760, 547430400, 300, 40.0, 160.0, 8, 4, 64, 8 }, -+ { "5.2", 14, 8912896, 8192, 4352, 1069547520, 1094860800, 300, 60.0, 240.0, 8, 4, 64, 8 }, -+ { "5.3", 15, 8912896, 8192, 4352, 1069547520, 1176502272, 300, 60.0, 240.0, 8, 4, 64, 8 }, -+ { "6.0", 16, 35651584, 16384, 8704, 1069547520, 1176502272, 300, 60.0, 240.0, 8, 4, 128, 16 }, -+ { "6.1", 17, 35651584, 16384, 8704, 2139095040, 2189721600, 300, 100.0, 480.0, 8, 4, 128, 16 }, -+ { "6.2", 18, 35651584, 16384, 8704, 4278190080, 4379443200, 300, 160.0, 800.0, 8, 4, 128, 16 }, -+ { "6.3", 19, 35651584, 16384, 8704, 4278190080, 4706009088, 300, 160.0, 800.0, 8, 4, 128, 16 }, -+}; -+ -+const AV1LevelDescriptor *ff_av1_guess_level(int64_t bitrate, -+ int tier, -+ int width, -+ int height, -+ int tiles, -+ int tile_cols, -+ float fps) -+{ -+ int pic_size; -+ uint64_t display_rate; -+ float max_br; -+ -+ pic_size = width * height; -+ display_rate = (uint64_t)pic_size * fps; -+ -+ for (int i = 0; i < FF_ARRAY_ELEMS(av1_levels); i++) { -+ const AV1LevelDescriptor *level = &av1_levels[i]; -+ // Limitation: decode rate, header rate, compress rate, etc. are not considered. -+ if (pic_size > level->max_pic_size) -+ continue; -+ if (width > level->max_h_size) -+ continue; -+ if (height > level->max_v_size) -+ continue; -+ if (display_rate > level->max_display_rate) -+ continue; -+ -+ if (tier) -+ max_br = level->high_mbps; -+ else -+ max_br = level->main_mbps; -+ if (!max_br) -+ continue; -+ if (bitrate > (int64_t)(1000000.0 * max_br)) -+ continue; -+ -+ if (tiles > level->max_tiles) -+ continue; -+ if (tile_cols > level->max_tile_cols) -+ continue; -+ return level; -+ } -+ -+ return NULL; -+} -diff --git a/libavcodec/av1_levels.h b/libavcodec/av1_levels.h -new file mode 100644 -index 0000000..164cb87 ---- /dev/null -+++ b/libavcodec/av1_levels.h -@@ -0,0 +1,58 @@ -+/* -+ * Copyright (c) 2023 Intel Corporation -+ * -+ * This file is part of FFmpeg. -+ * -+ * FFmpeg is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License as published by the Free Software Foundation; either -+ * version 2.1 of the License, or (at your option) any later version. -+ * -+ * FFmpeg is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with FFmpeg; if not, write to the Free Software -+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -+ */ -+ -+#ifndef AVCODEC_AV1_LEVELS_H -+#define AVCODEC_AV1_LEVELS_H -+ -+#include -+ -+typedef struct AV1LevelDescriptor { -+ char name[4]; -+ uint8_t level_idx; -+ -+ uint32_t max_pic_size; -+ uint32_t max_h_size; -+ uint32_t max_v_size; -+ uint64_t max_display_rate; -+ uint64_t max_decode_rate; -+ -+ uint32_t max_header_rate; -+ float main_mbps; -+ float high_mbps; -+ uint32_t main_cr; -+ uint32_t high_cr; -+ uint32_t max_tiles; -+ uint32_t max_tile_cols; -+} AV1LevelDescriptor; -+ -+/** -+ * Guess the level of a stream from some parameters. -+ * -+ * Unknown parameters may be zero, in which case they will be ignored. -+ */ -+const AV1LevelDescriptor *ff_av1_guess_level(int64_t bitrate, -+ int tier, -+ int width, -+ int height, -+ int tile_rows, -+ int tile_cols, -+ float fps); -+ -+#endif /* AVCODEC_AV1_LEVELS_H */ -diff --git a/libavcodec/cbs.c b/libavcodec/cbs.c -index 504197e..64b9aee 100644 ---- a/libavcodec/cbs.c -+++ b/libavcodec/cbs.c -@@ -111,8 +111,9 @@ av_cold int ff_cbs_init(CodedBitstreamContext **ctx_ptr, - - ctx->decompose_unit_types = NULL; - -- ctx->trace_enable = 0; -- ctx->trace_level = AV_LOG_TRACE; -+ ctx->trace_enable = 0; -+ ctx->trace_level = AV_LOG_TRACE; -+ ctx->trace_context = ctx; - - *ctx_ptr = ctx; - return 0; -@@ -490,19 +491,27 @@ void ff_cbs_trace_header(CodedBitstreamContext *ctx, - av_log(ctx->log_ctx, ctx->trace_level, "%s\n", name); - } - --void ff_cbs_trace_syntax_element(CodedBitstreamContext *ctx, int position, -- const char *str, const int *subscripts, -- const char *bits, int64_t value) -+void ff_cbs_trace_read_log(void *trace_context, -+ GetBitContext *gbc, int length, -+ const char *str, const int *subscripts, -+ int64_t value) - { -+ CodedBitstreamContext *ctx = trace_context; - char name[256]; -+ char bits[256]; - size_t name_len, bits_len; - int pad, subs, i, j, k, n; -- -- if (!ctx->trace_enable) -- return; -+ int position; - - av_assert0(value >= INT_MIN && value <= UINT32_MAX); - -+ position = get_bits_count(gbc); -+ -+ av_assert0(length < 256); -+ for (i = 0; i < length; i++) -+ bits[i] = get_bits1(gbc) ? '1' : '0'; -+ bits[length] = 0; -+ - subs = subscripts ? subscripts[0] : 0; - n = 0; - for (i = j = 0; str[i];) { -@@ -529,7 +538,7 @@ void ff_cbs_trace_syntax_element(CodedBitstreamContext *ctx, int position, - av_assert0(n == subs); - - name_len = strlen(name); -- bits_len = strlen(bits); -+ bits_len = length; - - if (name_len + bits_len > 60) - pad = bits_len + 2; -@@ -540,14 +549,48 @@ void ff_cbs_trace_syntax_element(CodedBitstreamContext *ctx, int position, - position, name, pad, bits, value); - } - --int ff_cbs_read_unsigned(CodedBitstreamContext *ctx, GetBitContext *gbc, -- int width, const char *name, -- const int *subscripts, uint32_t *write_to, -- uint32_t range_min, uint32_t range_max) -+void ff_cbs_trace_write_log(void *trace_context, -+ PutBitContext *pbc, int length, -+ const char *str, const int *subscripts, -+ int64_t value) - { -- uint32_t value; -+ CodedBitstreamContext *ctx = trace_context; -+ -+ // Ensure that the syntax element is written to the output buffer, -+ // make a GetBitContext pointed at the start position, then call the -+ // read log function which can read the bits back to log them. -+ -+ GetBitContext gbc; - int position; - -+ if (length > 0) { -+ PutBitContext flush; -+ flush = *pbc; -+ flush_put_bits(&flush); -+ } -+ -+ position = put_bits_count(pbc); -+ av_assert0(position >= length); -+ -+ init_get_bits(&gbc, pbc->buf, position); -+ -+ skip_bits_long(&gbc, position - length); -+ -+ ff_cbs_trace_read_log(ctx, &gbc, length, str, subscripts, value); -+} -+ -+static av_always_inline int cbs_read_unsigned(CodedBitstreamContext *ctx, -+ GetBitContext *gbc, -+ int width, const char *name, -+ const int *subscripts, -+ uint32_t *write_to, -+ uint32_t range_min, -+ uint32_t range_max) -+{ -+ uint32_t value; -+ -+ CBS_TRACE_READ_START(); -+ - av_assert0(width > 0 && width <= 32); - - if (get_bits_left(gbc) < width) { -@@ -556,21 +599,9 @@ int ff_cbs_read_unsigned(CodedBitstreamContext *ctx, GetBitContext *gbc, - return AVERROR_INVALIDDATA; - } - -- if (ctx->trace_enable) -- position = get_bits_count(gbc); -- - value = get_bits_long(gbc, width); - -- if (ctx->trace_enable) { -- char bits[33]; -- int i; -- for (i = 0; i < width; i++) -- bits[i] = value >> (width - i - 1) & 1 ? '1' : '0'; -- bits[i] = 0; -- -- ff_cbs_trace_syntax_element(ctx, position, name, subscripts, -- bits, value); -- } -+ CBS_TRACE_READ_END(); - - if (value < range_min || value > range_max) { - av_log(ctx->log_ctx, AV_LOG_ERROR, "%s out of range: " -@@ -583,11 +614,29 @@ int ff_cbs_read_unsigned(CodedBitstreamContext *ctx, GetBitContext *gbc, - return 0; - } - -+int ff_cbs_read_unsigned(CodedBitstreamContext *ctx, GetBitContext *gbc, -+ int width, const char *name, -+ const int *subscripts, uint32_t *write_to, -+ uint32_t range_min, uint32_t range_max) -+{ -+ return cbs_read_unsigned(ctx, gbc, width, name, subscripts, -+ write_to, range_min, range_max); -+} -+ -+int ff_cbs_read_simple_unsigned(CodedBitstreamContext *ctx, GetBitContext *gbc, -+ int width, const char *name, uint32_t *write_to) -+{ -+ return cbs_read_unsigned(ctx, gbc, width, name, NULL, -+ write_to, 0, UINT32_MAX); -+} -+ - int ff_cbs_write_unsigned(CodedBitstreamContext *ctx, PutBitContext *pbc, - int width, const char *name, - const int *subscripts, uint32_t value, - uint32_t range_min, uint32_t range_max) - { -+ CBS_TRACE_WRITE_START(); -+ - av_assert0(width > 0 && width <= 32); - - if (value < range_min || value > range_max) { -@@ -600,32 +649,31 @@ int ff_cbs_write_unsigned(CodedBitstreamContext *ctx, PutBitContext *pbc, - if (put_bits_left(pbc) < width) - return AVERROR(ENOSPC); - -- if (ctx->trace_enable) { -- char bits[33]; -- int i; -- for (i = 0; i < width; i++) -- bits[i] = value >> (width - i - 1) & 1 ? '1' : '0'; -- bits[i] = 0; -- -- ff_cbs_trace_syntax_element(ctx, put_bits_count(pbc), -- name, subscripts, bits, value); -- } -- - if (width < 32) - put_bits(pbc, width, value); - else - put_bits32(pbc, value); - -+ CBS_TRACE_WRITE_END(); -+ - return 0; - } - -+int ff_cbs_write_simple_unsigned(CodedBitstreamContext *ctx, PutBitContext *pbc, -+ int width, const char *name, uint32_t value) -+{ -+ return ff_cbs_write_unsigned(ctx, pbc, width, name, NULL, -+ value, 0, MAX_UINT_BITS(width)); -+} -+ - int ff_cbs_read_signed(CodedBitstreamContext *ctx, GetBitContext *gbc, - int width, const char *name, - const int *subscripts, int32_t *write_to, - int32_t range_min, int32_t range_max) - { - int32_t value; -- int position; -+ -+ CBS_TRACE_READ_START(); - - av_assert0(width > 0 && width <= 32); - -@@ -635,21 +683,9 @@ int ff_cbs_read_signed(CodedBitstreamContext *ctx, GetBitContext *gbc, - return AVERROR_INVALIDDATA; - } - -- if (ctx->trace_enable) -- position = get_bits_count(gbc); -- - value = get_sbits_long(gbc, width); - -- if (ctx->trace_enable) { -- char bits[33]; -- int i; -- for (i = 0; i < width; i++) -- bits[i] = value & (1U << (width - i - 1)) ? '1' : '0'; -- bits[i] = 0; -- -- ff_cbs_trace_syntax_element(ctx, position, name, subscripts, -- bits, value); -- } -+ CBS_TRACE_READ_END(); - - if (value < range_min || value > range_max) { - av_log(ctx->log_ctx, AV_LOG_ERROR, "%s out of range: " -@@ -667,6 +703,8 @@ int ff_cbs_write_signed(CodedBitstreamContext *ctx, PutBitContext *pbc, - const int *subscripts, int32_t value, - int32_t range_min, int32_t range_max) - { -+ CBS_TRACE_WRITE_START(); -+ - av_assert0(width > 0 && width <= 32); - - if (value < range_min || value > range_max) { -@@ -679,22 +717,13 @@ int ff_cbs_write_signed(CodedBitstreamContext *ctx, PutBitContext *pbc, - if (put_bits_left(pbc) < width) - return AVERROR(ENOSPC); - -- if (ctx->trace_enable) { -- char bits[33]; -- int i; -- for (i = 0; i < width; i++) -- bits[i] = value & (1U << (width - i - 1)) ? '1' : '0'; -- bits[i] = 0; -- -- ff_cbs_trace_syntax_element(ctx, put_bits_count(pbc), -- name, subscripts, bits, value); -- } -- - if (width < 32) - put_sbits(pbc, width, value); - else - put_bits32(pbc, value); - -+ CBS_TRACE_WRITE_END(); -+ - return 0; - } - -diff --git a/libavcodec/cbs.h b/libavcodec/cbs.h -index ee21623..f6509a2 100644 ---- a/libavcodec/cbs.h -+++ b/libavcodec/cbs.h -@@ -167,6 +167,51 @@ typedef struct CodedBitstreamFragment { - CodedBitstreamUnit *units; - } CodedBitstreamFragment; - -+ -+struct CodedBitstreamContext; -+struct GetBitContext; -+struct PutBitContext; -+ -+/** -+ * Callback type for read tracing. -+ * -+ * @param ctx User-set trace context. -+ * @param gbc A GetBitContext set at the start of the syntax -+ * element. This is a copy, the callee does not -+ * need to preserve it. -+ * @param length Length in bits of the syntax element. -+ * @param name String name of the syntax elements. -+ * @param subscripts If the syntax element is an array, a pointer to -+ * an array of subscripts into the array. -+ * @param value Parsed value of the syntax element. -+ */ -+typedef void (*CBSTraceReadCallback)(void *trace_context, -+ struct GetBitContext *gbc, -+ int start_position, -+ const char *name, -+ const int *subscripts, -+ int64_t value); -+ -+/** -+ * Callback type for write tracing. -+ * -+ * @param ctx User-set trace context. -+ * @param pbc A PutBitContext set at the end of the syntax -+ * element. The user must not modify this, but may -+ * inspect it to determine state. -+ * @param length Length in bits of the syntax element. -+ * @param name String name of the syntax elements. -+ * @param subscripts If the syntax element is an array, a pointer to -+ * an array of subscripts into the array. -+ * @param value Written value of the syntax element. -+ */ -+typedef void (*CBSTraceWriteCallback)(void *trace_context, -+ struct PutBitContext *pbc, -+ int start_position, -+ const char *name, -+ const int *subscripts, -+ int64_t value); -+ - /** - * Context structure for coded bitstream operations. - */ -@@ -210,11 +255,29 @@ typedef struct CodedBitstreamContext { - */ - int trace_enable; - /** -- * Log level to use for trace output. -+ * Log level to use for default trace output. - * - * From AV_LOG_*; defaults to AV_LOG_TRACE. - */ - int trace_level; -+ /** -+ * User context pointer to pass to trace callbacks. -+ */ -+ void *trace_context; -+ /** -+ * Callback for read tracing. -+ * -+ * If tracing is enabled then this is called once for each syntax -+ * element parsed. -+ */ -+ CBSTraceReadCallback trace_read_callback; -+ /** -+ * Callback for write tracing. -+ * -+ * If tracing is enabled then this is called once for each syntax -+ * element written. -+ */ -+ CBSTraceWriteCallback trace_write_callback; - - /** - * Write buffer. Used as intermediate buffer when writing units. -@@ -433,4 +496,27 @@ int ff_cbs_make_unit_writable(CodedBitstreamContext *ctx, - CodedBitstreamUnit *unit); - - -+ -+/** -+ * Helper function for read tracing which formats the syntax element -+ * and logs the result. -+ * -+ * Trace context should be set to the CodedBitstreamContext. -+ */ -+void ff_cbs_trace_read_log(void *trace_context, -+ struct GetBitContext *gbc, int length, -+ const char *str, const int *subscripts, -+ int64_t value); -+ -+/** -+ * Helper function for write tracing which formats the syntax element -+ * and logs the result. -+ * -+ * Trace context should be set to the CodedBitstreamContext. -+ */ -+void ff_cbs_trace_write_log(void *trace_context, -+ struct PutBitContext *pbc, int length, -+ const char *str, const int *subscripts, -+ int64_t value); -+ - #endif /* AVCODEC_CBS_H */ -diff --git a/libavcodec/cbs_av1.c b/libavcodec/cbs_av1.c -index 45e1288..6098c97 100644 ---- a/libavcodec/cbs_av1.c -+++ b/libavcodec/cbs_av1.c -@@ -31,10 +31,8 @@ static int cbs_av1_read_uvlc(CodedBitstreamContext *ctx, GetBitContext *gbc, - uint32_t range_min, uint32_t range_max) - { - uint32_t zeroes, bits_value, value; -- int position; - -- if (ctx->trace_enable) -- position = get_bits_count(gbc); -+ CBS_TRACE_READ_START(); - - zeroes = 0; - while (1) { -@@ -50,6 +48,9 @@ static int cbs_av1_read_uvlc(CodedBitstreamContext *ctx, GetBitContext *gbc, - } - - if (zeroes >= 32) { -+ // Note that the spec allows an arbitrarily large number of -+ // zero bits followed by a one bit in this case, but the -+ // libaom implementation does not support it. - value = MAX_UINT_BITS(32); - } else { - if (get_bits_left(gbc) < zeroes) { -@@ -62,36 +63,7 @@ static int cbs_av1_read_uvlc(CodedBitstreamContext *ctx, GetBitContext *gbc, - value = bits_value + (UINT32_C(1) << zeroes) - 1; - } - -- if (ctx->trace_enable) { -- char bits[65]; -- int i, j, k; -- -- if (zeroes >= 32) { -- while (zeroes > 32) { -- k = FFMIN(zeroes - 32, 32); -- for (i = 0; i < k; i++) -- bits[i] = '0'; -- bits[i] = 0; -- ff_cbs_trace_syntax_element(ctx, position, name, -- NULL, bits, 0); -- zeroes -= k; -- position += k; -- } -- } -- -- for (i = 0; i < zeroes; i++) -- bits[i] = '0'; -- bits[i++] = '1'; -- -- if (zeroes < 32) { -- for (j = 0; j < zeroes; j++) -- bits[i++] = (bits_value >> (zeroes - j - 1) & 1) ? '1' : '0'; -- } -- -- bits[i] = 0; -- ff_cbs_trace_syntax_element(ctx, position, name, -- NULL, bits, value); -- } -+ CBS_TRACE_READ_END_NO_SUBSCRIPTS(); - - if (value < range_min || value > range_max) { - av_log(ctx->log_ctx, AV_LOG_ERROR, "%s out of range: " -@@ -109,7 +81,9 @@ static int cbs_av1_write_uvlc(CodedBitstreamContext *ctx, PutBitContext *pbc, - uint32_t range_min, uint32_t range_max) - { - uint32_t v; -- int position, zeroes; -+ int zeroes; -+ -+ CBS_TRACE_WRITE_START(); - - if (value < range_min || value > range_max) { - av_log(ctx->log_ctx, AV_LOG_ERROR, "%s out of range: " -@@ -118,28 +92,17 @@ static int cbs_av1_write_uvlc(CodedBitstreamContext *ctx, PutBitContext *pbc, - return AVERROR_INVALIDDATA; - } - -- if (ctx->trace_enable) -- position = put_bits_count(pbc); -- - zeroes = av_log2(value + 1); - v = value - (1U << zeroes) + 1; -+ -+ if (put_bits_left(pbc) < 2 * zeroes + 1) -+ return AVERROR(ENOSPC); -+ - put_bits(pbc, zeroes, 0); - put_bits(pbc, 1, 1); - put_bits(pbc, zeroes, v); - -- if (ctx->trace_enable) { -- char bits[65]; -- int i, j; -- i = 0; -- for (j = 0; j < zeroes; j++) -- bits[i++] = '0'; -- bits[i++] = '1'; -- for (j = 0; j < zeroes; j++) -- bits[i++] = (v >> (zeroes - j - 1) & 1) ? '1' : '0'; -- bits[i++] = 0; -- ff_cbs_trace_syntax_element(ctx, position, name, NULL, -- bits, value); -- } -+ CBS_TRACE_WRITE_END_NO_SUBSCRIPTS(); - - return 0; - } -@@ -148,20 +111,19 @@ static int cbs_av1_read_leb128(CodedBitstreamContext *ctx, GetBitContext *gbc, - const char *name, uint64_t *write_to) - { - uint64_t value; -- int position, err, i; -+ uint32_t byte; -+ int i; - -- if (ctx->trace_enable) -- position = get_bits_count(gbc); -+ CBS_TRACE_READ_START(); - - value = 0; - for (i = 0; i < 8; i++) { -- int subscript[2] = { 1, i }; -- uint32_t byte; -- err = ff_cbs_read_unsigned(ctx, gbc, 8, "leb128_byte[i]", subscript, -- &byte, 0x00, 0xff); -- if (err < 0) -- return err; -- -+ if (get_bits_left(gbc) < 8) { -+ av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid leb128 at " -+ "%s: bitstream ended.\n", name); -+ return AVERROR_INVALIDDATA; -+ } -+ byte = get_bits(gbc, 8); - value |= (uint64_t)(byte & 0x7f) << (i * 7); - if (!(byte & 0x80)) - break; -@@ -170,39 +132,38 @@ static int cbs_av1_read_leb128(CodedBitstreamContext *ctx, GetBitContext *gbc, - if (value > UINT32_MAX) - return AVERROR_INVALIDDATA; - -- if (ctx->trace_enable) -- ff_cbs_trace_syntax_element(ctx, position, name, NULL, "", value); -+ CBS_TRACE_READ_END_NO_SUBSCRIPTS(); - - *write_to = value; - return 0; - } - -+/** Minimum byte length will be used to indicate the len128 of value if byte_len is 0. */ - static int cbs_av1_write_leb128(CodedBitstreamContext *ctx, PutBitContext *pbc, -- const char *name, uint64_t value) -+ const char *name, uint64_t value, uint8_t byte_len) - { -- int position, err, len, i; -+ int len, i; - uint8_t byte; - -- len = (av_log2(value) + 7) / 7; -+ CBS_TRACE_WRITE_START(); -+ -+ if (byte_len) -+ av_assert0(byte_len >= (av_log2(value) + 7) / 7); - -- if (ctx->trace_enable) -- position = put_bits_count(pbc); -+ len = byte_len ? byte_len : (av_log2(value) + 7) / 7; - - for (i = 0; i < len; i++) { -- int subscript[2] = { 1, i }; -+ if (put_bits_left(pbc) < 8) -+ return AVERROR(ENOSPC); - - byte = value >> (7 * i) & 0x7f; - if (i < len - 1) - byte |= 0x80; - -- err = ff_cbs_write_unsigned(ctx, pbc, 8, "leb128_byte[i]", subscript, -- byte, 0x00, 0xff); -- if (err < 0) -- return err; -+ put_bits(pbc, 8, byte); - } - -- if (ctx->trace_enable) -- ff_cbs_trace_syntax_element(ctx, position, name, NULL, "", value); -+ CBS_TRACE_WRITE_END_NO_SUBSCRIPTS(); - - return 0; - } -@@ -212,12 +173,11 @@ static int cbs_av1_read_ns(CodedBitstreamContext *ctx, GetBitContext *gbc, - const int *subscripts, uint32_t *write_to) - { - uint32_t m, v, extra_bit, value; -- int position, w; -+ int w; - -- av_assert0(n > 0); -+ CBS_TRACE_READ_START(); - -- if (ctx->trace_enable) -- position = get_bits_count(gbc); -+ av_assert0(n > 0); - - w = av_log2(n) + 1; - m = (1 << w) - n; -@@ -240,18 +200,7 @@ static int cbs_av1_read_ns(CodedBitstreamContext *ctx, GetBitContext *gbc, - value = (v << 1) - m + extra_bit; - } - -- if (ctx->trace_enable) { -- char bits[33]; -- int i; -- for (i = 0; i < w - 1; i++) -- bits[i] = (v >> i & 1) ? '1' : '0'; -- if (v >= m) -- bits[i++] = extra_bit ? '1' : '0'; -- bits[i] = 0; -- -- ff_cbs_trace_syntax_element(ctx, position, -- name, subscripts, bits, value); -- } -+ CBS_TRACE_READ_END(); - - *write_to = value; - return 0; -@@ -262,7 +211,8 @@ static int cbs_av1_write_ns(CodedBitstreamContext *ctx, PutBitContext *pbc, - const int *subscripts, uint32_t value) - { - uint32_t w, m, v, extra_bit; -- int position; -+ -+ CBS_TRACE_WRITE_START(); - - if (value > n) { - av_log(ctx->log_ctx, AV_LOG_ERROR, "%s out of range: " -@@ -271,9 +221,6 @@ static int cbs_av1_write_ns(CodedBitstreamContext *ctx, PutBitContext *pbc, - return AVERROR_INVALIDDATA; - } - -- if (ctx->trace_enable) -- position = put_bits_count(pbc); -- - w = av_log2(n) + 1; - m = (1 << w) - n; - -@@ -290,18 +237,7 @@ static int cbs_av1_write_ns(CodedBitstreamContext *ctx, PutBitContext *pbc, - put_bits(pbc, 1, extra_bit); - } - -- if (ctx->trace_enable) { -- char bits[33]; -- int i; -- for (i = 0; i < w - 1; i++) -- bits[i] = (v >> i & 1) ? '1' : '0'; -- if (value >= m) -- bits[i++] = extra_bit ? '1' : '0'; -- bits[i] = 0; -- -- ff_cbs_trace_syntax_element(ctx, position, -- name, subscripts, bits, value); -- } -+ CBS_TRACE_WRITE_END(); - - return 0; - } -@@ -311,33 +247,24 @@ static int cbs_av1_read_increment(CodedBitstreamContext *ctx, GetBitContext *gbc - const char *name, uint32_t *write_to) - { - uint32_t value; -- int position, i; -- char bits[33]; - -- av_assert0(range_min <= range_max && range_max - range_min < sizeof(bits) - 1); -- if (ctx->trace_enable) -- position = get_bits_count(gbc); -+ CBS_TRACE_READ_START(); -+ -+ av_assert0(range_min <= range_max && range_max - range_min < 32); - -- for (i = 0, value = range_min; value < range_max;) { -+ for (value = range_min; value < range_max;) { - if (get_bits_left(gbc) < 1) { - av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid increment value at " - "%s: bitstream ended.\n", name); - return AVERROR_INVALIDDATA; - } -- if (get_bits1(gbc)) { -- bits[i++] = '1'; -+ if (get_bits1(gbc)) - ++value; -- } else { -- bits[i++] = '0'; -+ else - break; -- } - } - -- if (ctx->trace_enable) { -- bits[i] = 0; -- ff_cbs_trace_syntax_element(ctx, position, -- name, NULL, bits, value); -- } -+ CBS_TRACE_READ_END_NO_SUBSCRIPTS(); - - *write_to = value; - return 0; -@@ -349,6 +276,8 @@ static int cbs_av1_write_increment(CodedBitstreamContext *ctx, PutBitContext *pb - { - int len; - -+ CBS_TRACE_WRITE_START(); -+ - av_assert0(range_min <= range_max && range_max - range_min < 32); - if (value < range_min || value > range_max) { - av_log(ctx->log_ctx, AV_LOG_ERROR, "%s out of range: " -@@ -364,23 +293,11 @@ static int cbs_av1_write_increment(CodedBitstreamContext *ctx, PutBitContext *pb - if (put_bits_left(pbc) < len) - return AVERROR(ENOSPC); - -- if (ctx->trace_enable) { -- char bits[33]; -- int i; -- for (i = 0; i < len; i++) { -- if (range_min + i == value) -- bits[i] = '0'; -- else -- bits[i] = '1'; -- } -- bits[i] = 0; -- ff_cbs_trace_syntax_element(ctx, put_bits_count(pbc), -- name, NULL, bits, value); -- } -- - if (len > 0) - put_bits(pbc, len, (1 << len) - 1 - (value != range_max)); - -+ CBS_TRACE_WRITE_END_NO_SUBSCRIPTS(); -+ - return 0; - } - -@@ -388,12 +305,10 @@ static int cbs_av1_read_subexp(CodedBitstreamContext *ctx, GetBitContext *gbc, - uint32_t range_max, const char *name, - const int *subscripts, uint32_t *write_to) - { -- uint32_t value; -- int position, err; -- uint32_t max_len, len, range_offset, range_bits; -+ uint32_t value, max_len, len, range_offset, range_bits; -+ int err; - -- if (ctx->trace_enable) -- position = get_bits_count(gbc); -+ CBS_TRACE_READ_START(); - - av_assert0(range_max > 0); - max_len = av_log2(range_max - 1) - 3; -@@ -412,9 +327,8 @@ static int cbs_av1_read_subexp(CodedBitstreamContext *ctx, GetBitContext *gbc, - } - - if (len < max_len) { -- err = ff_cbs_read_unsigned(ctx, gbc, range_bits, -- "subexp_bits", NULL, &value, -- 0, MAX_UINT_BITS(range_bits)); -+ err = ff_cbs_read_simple_unsigned(ctx, gbc, range_bits, -+ "subexp_bits", &value); - if (err < 0) - return err; - -@@ -426,9 +340,7 @@ static int cbs_av1_read_subexp(CodedBitstreamContext *ctx, GetBitContext *gbc, - } - value += range_offset; - -- if (ctx->trace_enable) -- ff_cbs_trace_syntax_element(ctx, position, -- name, subscripts, "", value); -+ CBS_TRACE_READ_END_VALUE_ONLY(); - - *write_to = value; - return err; -@@ -438,9 +350,11 @@ static int cbs_av1_write_subexp(CodedBitstreamContext *ctx, PutBitContext *pbc, - uint32_t range_max, const char *name, - const int *subscripts, uint32_t value) - { -- int position, err; -+ int err; - uint32_t max_len, len, range_offset, range_bits; - -+ CBS_TRACE_WRITE_START(); -+ - if (value > range_max) { - av_log(ctx->log_ctx, AV_LOG_ERROR, "%s out of range: " - "%"PRIu32", but must be in [0,%"PRIu32"].\n", -@@ -448,9 +362,6 @@ static int cbs_av1_write_subexp(CodedBitstreamContext *ctx, PutBitContext *pbc, - return AVERROR_INVALIDDATA; - } - -- if (ctx->trace_enable) -- position = put_bits_count(pbc); -- - av_assert0(range_max > 0); - max_len = av_log2(range_max - 1) - 3; - -@@ -476,10 +387,9 @@ static int cbs_av1_write_subexp(CodedBitstreamContext *ctx, PutBitContext *pbc, - return err; - - if (len < max_len) { -- err = ff_cbs_write_unsigned(ctx, pbc, range_bits, -- "subexp_bits", NULL, -- value - range_offset, -- 0, MAX_UINT_BITS(range_bits)); -+ err = ff_cbs_write_simple_unsigned(ctx, pbc, range_bits, -+ "subexp_bits", -+ value - range_offset); - if (err < 0) - return err; - -@@ -491,9 +401,7 @@ static int cbs_av1_write_subexp(CodedBitstreamContext *ctx, PutBitContext *pbc, - return err; - } - -- if (ctx->trace_enable) -- ff_cbs_trace_syntax_element(ctx, position, -- name, subscripts, "", value); -+ CBS_TRACE_WRITE_END_VALUE_ONLY(); - - return err; - } -@@ -546,8 +454,6 @@ static size_t cbs_av1_get_payload_bytes_left(GetBitContext *gbc) - - #define SUBSCRIPTS(subs, ...) (subs > 0 ? ((int[subs + 1]){ subs, __VA_ARGS__ }) : NULL) - --#define fb(width, name) \ -- xf(width, name, current->name, 0, MAX_UINT_BITS(width), 0, ) - #define fc(width, name, range_min, range_max) \ - xf(width, name, current->name, range_min, range_max, 0, ) - #define flag(name) fb(1, name) -@@ -573,6 +479,13 @@ static size_t cbs_av1_get_payload_bytes_left(GetBitContext *gbc) - #define READWRITE read - #define RWContext GetBitContext - -+#define fb(width, name) do { \ -+ uint32_t value; \ -+ CHECK(ff_cbs_read_simple_unsigned(ctx, rw, width, \ -+ #name, &value)); \ -+ current->name = value; \ -+ } while (0) -+ - #define xf(width, name, var, range_min, range_max, subs, ...) do { \ - uint32_t value; \ - CHECK(ff_cbs_read_unsigned(ctx, rw, width, #name, \ -@@ -645,6 +558,7 @@ static size_t cbs_av1_get_payload_bytes_left(GetBitContext *gbc) - #undef READ - #undef READWRITE - #undef RWContext -+#undef fb - #undef xf - #undef xsu - #undef uvlc -@@ -661,6 +575,11 @@ static size_t cbs_av1_get_payload_bytes_left(GetBitContext *gbc) - #define READWRITE write - #define RWContext PutBitContext - -+#define fb(width, name) do { \ -+ CHECK(ff_cbs_write_simple_unsigned(ctx, rw, width, #name, \ -+ current->name)); \ -+ } while (0) -+ - #define xf(width, name, var, range_min, range_max, subs, ...) do { \ - CHECK(ff_cbs_write_unsigned(ctx, rw, width, #name, \ - SUBSCRIPTS(subs, __VA_ARGS__), \ -@@ -703,7 +622,7 @@ static size_t cbs_av1_get_payload_bytes_left(GetBitContext *gbc) - } while (0) - - #define leb128(name) do { \ -- CHECK(cbs_av1_write_leb128(ctx, rw, #name, current->name)); \ -+ CHECK(cbs_av1_write_leb128(ctx, rw, #name, current->name, 0)); \ - } while (0) - - #define infer(name, value) do { \ -@@ -723,6 +642,7 @@ static size_t cbs_av1_get_payload_bytes_left(GetBitContext *gbc) - #undef WRITE - #undef READWRITE - #undef RWContext -+#undef fb - #undef xf - #undef xsu - #undef uvlc -@@ -1086,9 +1006,14 @@ static int cbs_av1_write_obu(CodedBitstreamContext *ctx, - - if (obu->header.obu_has_size_field) { - pbc_tmp = *pbc; -- // Add space for the size field to fill later. -- put_bits32(pbc, 0); -- put_bits32(pbc, 0); -+ if (obu->obu_size_byte_len) { -+ for (int i = 0; i < obu->obu_size_byte_len; i++) -+ put_bits(pbc, 8, 0); -+ } else { -+ // Add space for the size field to fill later. -+ put_bits32(pbc, 0); -+ put_bits32(pbc, 0); -+ } - } - - td = NULL; -@@ -1208,7 +1133,7 @@ static int cbs_av1_write_obu(CodedBitstreamContext *ctx, - end_pos /= 8; - - *pbc = pbc_tmp; -- err = cbs_av1_write_leb128(ctx, pbc, "obu_size", obu->obu_size); -+ err = cbs_av1_write_leb128(ctx, pbc, "obu_size", obu->obu_size, obu->obu_size_byte_len); - if (err < 0) - goto error; - -@@ -1225,8 +1150,11 @@ static int cbs_av1_write_obu(CodedBitstreamContext *ctx, - } - - if (obu->obu_size > 0) { -- memmove(pbc->buf + data_pos, -- pbc->buf + start_pos, header_size); -+ if (!obu->obu_size_byte_len) { -+ obu->obu_size_byte_len = start_pos - data_pos; -+ memmove(pbc->buf + data_pos, -+ pbc->buf + start_pos, header_size); -+ } - skip_put_bytes(pbc, header_size); - - if (td) { -diff --git a/libavcodec/cbs_av1.h b/libavcodec/cbs_av1.h -index 1fc80dc..c5dae3c 100644 ---- a/libavcodec/cbs_av1.h -+++ b/libavcodec/cbs_av1.h -@@ -392,6 +392,7 @@ typedef struct AV1RawOBU { - AV1RawOBUHeader header; - - size_t obu_size; -+ uint8_t obu_size_byte_len; - - union { - AV1RawSequenceHeader sequence_header; -diff --git a/libavcodec/cbs_av1_syntax_template.c b/libavcodec/cbs_av1_syntax_template.c -index e95925a..cf2e259 100644 ---- a/libavcodec/cbs_av1_syntax_template.c -+++ b/libavcodec/cbs_av1_syntax_template.c -@@ -1018,9 +1018,9 @@ static int FUNC(read_tx_mode)(CodedBitstreamContext *ctx, RWContext *rw, - int err; - - if (priv->coded_lossless) -- infer(tx_mode, 0); -+ infer(tx_mode, AV1_ONLY_4X4); - else -- increment(tx_mode, 1, 2); -+ increment(tx_mode, AV1_TX_MODE_LARGEST, AV1_TX_MODE_SELECT); - - return 0; - } -diff --git a/libavcodec/cbs_bsf.c b/libavcodec/cbs_bsf.c -index 069f6e9..b252854 100644 ---- a/libavcodec/cbs_bsf.c -+++ b/libavcodec/cbs_bsf.c -@@ -123,6 +123,11 @@ int ff_cbs_bsf_generic_init(AVBSFContext *bsf, const CBSBSFType *type) - if (err < 0) - return err; - -+ ctx->output->trace_enable = 1; -+ ctx->output->trace_level = AV_LOG_TRACE; -+ ctx->output->trace_context = ctx->output; -+ ctx->output->trace_write_callback = ff_cbs_trace_write_log; -+ - if (bsf->par_in->extradata) { - err = ff_cbs_read_extradata(ctx->input, frag, bsf->par_in); - if (err < 0) { -diff --git a/libavcodec/cbs_h2645.c b/libavcodec/cbs_h2645.c -index 80e4882..355f4d5 100644 ---- a/libavcodec/cbs_h2645.c -+++ b/libavcodec/cbs_h2645.c -@@ -34,41 +34,38 @@ static int cbs_read_ue_golomb(CodedBitstreamContext *ctx, GetBitContext *gbc, - uint32_t *write_to, - uint32_t range_min, uint32_t range_max) - { -- uint32_t value; -- int position, i, j; -- unsigned int k; -- char bits[65]; -+ uint32_t leading_bits, value; -+ int max_length, leading_zeroes; - -- position = get_bits_count(gbc); -+ CBS_TRACE_READ_START(); - -- for (i = 0; i < 32; i++) { -- if (get_bits_left(gbc) < i + 1) { -+ max_length = FFMIN(get_bits_left(gbc), 32); -+ -+ leading_bits = show_bits_long(gbc, max_length); -+ if (leading_bits == 0) { -+ if (max_length >= 32) { -+ av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid ue-golomb code at " -+ "%s: more than 31 zeroes.\n", name); -+ return AVERROR_INVALIDDATA; -+ } else { - av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid ue-golomb code at " - "%s: bitstream ended.\n", name); - return AVERROR_INVALIDDATA; - } -- k = get_bits1(gbc); -- bits[i] = k ? '1' : '0'; -- if (k) -- break; - } -- if (i >= 32) { -+ -+ leading_zeroes = max_length - 1 - av_log2(leading_bits); -+ skip_bits_long(gbc, leading_zeroes); -+ -+ if (get_bits_left(gbc) < leading_zeroes + 1) { - av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid ue-golomb code at " -- "%s: more than 31 zeroes.\n", name); -+ "%s: bitstream ended.\n", name); - return AVERROR_INVALIDDATA; - } -- value = 1; -- for (j = 0; j < i; j++) { -- k = get_bits1(gbc); -- bits[i + j + 1] = k ? '1' : '0'; -- value = value << 1 | k; -- } -- bits[i + j + 1] = 0; -- --value; - -- if (ctx->trace_enable) -- ff_cbs_trace_syntax_element(ctx, position, name, subscripts, -- bits, value); -+ value = get_bits_long(gbc, leading_zeroes + 1) - 1; -+ -+ CBS_TRACE_READ_END(); - - if (value < range_min || value > range_max) { - av_log(ctx->log_ctx, AV_LOG_ERROR, "%s out of range: " -@@ -86,45 +83,44 @@ static int cbs_read_se_golomb(CodedBitstreamContext *ctx, GetBitContext *gbc, - int32_t *write_to, - int32_t range_min, int32_t range_max) - { -+ uint32_t leading_bits, unsigned_value; -+ int max_length, leading_zeroes; - int32_t value; -- int position, i, j; -- unsigned int k; -- uint32_t v; -- char bits[65]; - -- position = get_bits_count(gbc); -+ CBS_TRACE_READ_START(); - -- for (i = 0; i < 32; i++) { -- if (get_bits_left(gbc) < i + 1) { -+ max_length = FFMIN(get_bits_left(gbc), 32); -+ -+ leading_bits = show_bits_long(gbc, max_length); -+ if (leading_bits == 0) { -+ if (max_length >= 32) { -+ av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid se-golomb code at " -+ "%s: more than 31 zeroes.\n", name); -+ return AVERROR_INVALIDDATA; -+ } else { - av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid se-golomb code at " - "%s: bitstream ended.\n", name); - return AVERROR_INVALIDDATA; - } -- k = get_bits1(gbc); -- bits[i] = k ? '1' : '0'; -- if (k) -- break; - } -- if (i >= 32) { -+ -+ leading_zeroes = max_length - 1 - av_log2(leading_bits); -+ skip_bits_long(gbc, leading_zeroes); -+ -+ if (get_bits_left(gbc) < leading_zeroes + 1) { - av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid se-golomb code at " -- "%s: more than 31 zeroes.\n", name); -+ "%s: bitstream ended.\n", name); - return AVERROR_INVALIDDATA; - } -- v = 1; -- for (j = 0; j < i; j++) { -- k = get_bits1(gbc); -- bits[i + j + 1] = k ? '1' : '0'; -- v = v << 1 | k; -- } -- bits[i + j + 1] = 0; -- if (v & 1) -- value = -(int32_t)(v / 2); -+ -+ unsigned_value = get_bits_long(gbc, leading_zeroes + 1); -+ -+ if (unsigned_value & 1) -+ value = -(int32_t)(unsigned_value / 2); - else -- value = v / 2; -+ value = unsigned_value / 2; - -- if (ctx->trace_enable) -- ff_cbs_trace_syntax_element(ctx, position, name, subscripts, -- bits, value); -+ CBS_TRACE_READ_END(); - - if (value < range_min || value > range_max) { - av_log(ctx->log_ctx, AV_LOG_ERROR, "%s out of range: " -@@ -144,6 +140,8 @@ static int cbs_write_ue_golomb(CodedBitstreamContext *ctx, PutBitContext *pbc, - { - int len; - -+ CBS_TRACE_WRITE_START(); -+ - if (value < range_min || value > range_max) { - av_log(ctx->log_ctx, AV_LOG_ERROR, "%s out of range: " - "%"PRIu32", but must be in [%"PRIu32",%"PRIu32"].\n", -@@ -156,27 +154,14 @@ static int cbs_write_ue_golomb(CodedBitstreamContext *ctx, PutBitContext *pbc, - if (put_bits_left(pbc) < 2 * len + 1) - return AVERROR(ENOSPC); - -- if (ctx->trace_enable) { -- char bits[65]; -- int i; -- -- for (i = 0; i < len; i++) -- bits[i] = '0'; -- bits[len] = '1'; -- for (i = 0; i < len; i++) -- bits[len + i + 1] = (value + 1) >> (len - i - 1) & 1 ? '1' : '0'; -- bits[len + len + 1] = 0; -- -- ff_cbs_trace_syntax_element(ctx, put_bits_count(pbc), -- name, subscripts, bits, value); -- } -- - put_bits(pbc, len, 0); - if (len + 1 < 32) - put_bits(pbc, len + 1, value + 1); - else - put_bits32(pbc, value + 1); - -+ CBS_TRACE_WRITE_END(); -+ - return 0; - } - -@@ -188,6 +173,8 @@ static int cbs_write_se_golomb(CodedBitstreamContext *ctx, PutBitContext *pbc, - int len; - uint32_t uvalue; - -+ CBS_TRACE_WRITE_START(); -+ - if (value < range_min || value > range_max) { - av_log(ctx->log_ctx, AV_LOG_ERROR, "%s out of range: " - "%"PRId32", but must be in [%"PRId32",%"PRId32"].\n", -@@ -207,27 +194,14 @@ static int cbs_write_se_golomb(CodedBitstreamContext *ctx, PutBitContext *pbc, - if (put_bits_left(pbc) < 2 * len + 1) - return AVERROR(ENOSPC); - -- if (ctx->trace_enable) { -- char bits[65]; -- int i; -- -- for (i = 0; i < len; i++) -- bits[i] = '0'; -- bits[len] = '1'; -- for (i = 0; i < len; i++) -- bits[len + i + 1] = (uvalue + 1) >> (len - i - 1) & 1 ? '1' : '0'; -- bits[len + len + 1] = 0; -- -- ff_cbs_trace_syntax_element(ctx, put_bits_count(pbc), -- name, subscripts, bits, value); -- } -- - put_bits(pbc, len, 0); - if (len + 1 < 32) - put_bits(pbc, len + 1, uvalue + 1); - else - put_bits32(pbc, uvalue + 1); - -+ CBS_TRACE_WRITE_END(); -+ - return 0; - } - -@@ -261,8 +235,6 @@ static int cbs_h265_payload_extension_present(GetBitContext *gbc, uint32_t paylo - - #define u(width, name, range_min, range_max) \ - xu(width, name, current->name, range_min, range_max, 0, ) --#define ub(width, name) \ -- xu(width, name, current->name, 0, MAX_UINT_BITS(width), 0, ) - #define flag(name) ub(1, name) - #define ue(name, range_min, range_max) \ - xue(name, current->name, range_min, range_max, 0, ) -@@ -298,6 +270,12 @@ static int cbs_h265_payload_extension_present(GetBitContext *gbc, uint32_t paylo - #define READWRITE read - #define RWContext GetBitContext - -+#define ub(width, name) do { \ -+ uint32_t value; \ -+ CHECK(ff_cbs_read_simple_unsigned(ctx, rw, width, #name, \ -+ &value)); \ -+ current->name = value; \ -+ } while (0) - #define xu(width, name, var, range_min, range_max, subs, ...) do { \ - uint32_t value; \ - CHECK(ff_cbs_read_unsigned(ctx, rw, width, #name, \ -@@ -372,6 +350,7 @@ static int cbs_h2645_read_more_rbsp_data(GetBitContext *gbc) - #undef READ - #undef READWRITE - #undef RWContext -+#undef ub - #undef xu - #undef xi - #undef xue -@@ -387,6 +366,11 @@ static int cbs_h2645_read_more_rbsp_data(GetBitContext *gbc) - #define READWRITE write - #define RWContext PutBitContext - -+#define ub(width, name) do { \ -+ uint32_t value = current->name; \ -+ CHECK(ff_cbs_write_simple_unsigned(ctx, rw, width, #name, \ -+ value)); \ -+ } while (0) - #define xu(width, name, var, range_min, range_max, subs, ...) do { \ - uint32_t value = var; \ - CHECK(ff_cbs_write_unsigned(ctx, rw, width, #name, \ -@@ -450,6 +434,7 @@ static int cbs_h2645_read_more_rbsp_data(GetBitContext *gbc) - #undef WRITE - #undef READWRITE - #undef RWContext -+#undef ub - #undef xu - #undef xi - #undef xue -diff --git a/libavcodec/cbs_internal.h b/libavcodec/cbs_internal.h -index e585c77..60e31eb 100644 ---- a/libavcodec/cbs_internal.h -+++ b/libavcodec/cbs_internal.h -@@ -151,24 +151,29 @@ typedef struct CodedBitstreamType { - void ff_cbs_trace_header(CodedBitstreamContext *ctx, - const char *name); - --void ff_cbs_trace_syntax_element(CodedBitstreamContext *ctx, int position, -- const char *name, const int *subscripts, -- const char *bitstring, int64_t value); -- - - // Helper functions for read/write of common bitstream elements, including --// generation of trace output. -+// generation of trace output. The simple functions are equivalent to -+// their non-simple counterparts except that their range is unrestricted -+// (i.e. only limited by the amount of bits used) and they lack -+// the ability to use subscripts. - - int ff_cbs_read_unsigned(CodedBitstreamContext *ctx, GetBitContext *gbc, - int width, const char *name, - const int *subscripts, uint32_t *write_to, - uint32_t range_min, uint32_t range_max); - -+int ff_cbs_read_simple_unsigned(CodedBitstreamContext *ctx, GetBitContext *gbc, -+ int width, const char *name, uint32_t *write_to); -+ - int ff_cbs_write_unsigned(CodedBitstreamContext *ctx, PutBitContext *pbc, - int width, const char *name, - const int *subscripts, uint32_t value, - uint32_t range_min, uint32_t range_max); - -+int ff_cbs_write_simple_unsigned(CodedBitstreamContext *ctx, PutBitContext *pbc, -+ int width, const char *name, uint32_t value); -+ - int ff_cbs_read_signed(CodedBitstreamContext *ctx, GetBitContext *gbc, - int width, const char *name, - const int *subscripts, int32_t *write_to, -@@ -191,6 +196,87 @@ int ff_cbs_write_signed(CodedBitstreamContext *ctx, PutBitContext *pbc, - // range_min in the above functions. - #define MIN_INT_BITS(length) (-(INT64_C(1) << ((length) - 1))) - -+ -+// Start of a syntax element during read tracing. -+#define CBS_TRACE_READ_START() \ -+ GetBitContext trace_start; \ -+ do { \ -+ if (ctx->trace_enable) \ -+ trace_start = *gbc; \ -+ } while (0) -+ -+// End of a syntax element for tracing, make callback. -+#define CBS_TRACE_READ_END() \ -+ do { \ -+ if (ctx->trace_enable) { \ -+ int start_position = get_bits_count(&trace_start); \ -+ int end_position = get_bits_count(gbc); \ -+ av_assert0(start_position <= end_position); \ -+ ctx->trace_read_callback(ctx->trace_context, &trace_start, \ -+ end_position - start_position, \ -+ name, subscripts, value); \ -+ } \ -+ } while (0) -+ -+// End of a syntax element with no subscript entries. -+#define CBS_TRACE_READ_END_NO_SUBSCRIPTS() \ -+ do { \ -+ const int *subscripts = NULL; \ -+ CBS_TRACE_READ_END(); \ -+ } while (0) -+ -+// End of a syntax element which is made up of subelements which -+// are aleady traced, so we are only showing the value. -+#define CBS_TRACE_READ_END_VALUE_ONLY() \ -+ do { \ -+ if (ctx->trace_enable) { \ -+ ctx->trace_read_callback(ctx->trace_context, &trace_start, 0, \ -+ name, subscripts, value); \ -+ } \ -+ } while (0) -+ -+// Start of a syntax element during write tracing. -+#define CBS_TRACE_WRITE_START() \ -+ int start_position; \ -+ do { \ -+ if (ctx->trace_enable) \ -+ start_position = put_bits_count(pbc);; \ -+ } while (0) -+ -+// End of a syntax element for tracing, make callback. -+#define CBS_TRACE_WRITE_END() \ -+ do { \ -+ if (ctx->trace_enable) { \ -+ int end_position = put_bits_count(pbc); \ -+ av_assert0(start_position <= end_position); \ -+ ctx->trace_write_callback(ctx->trace_context, pbc, \ -+ end_position - start_position, \ -+ name, subscripts, value); \ -+ } \ -+ } while (0) -+ -+// End of a syntax element with no subscript entries. -+#define CBS_TRACE_WRITE_END_NO_SUBSCRIPTS() \ -+ do { \ -+ const int *subscripts = NULL; \ -+ CBS_TRACE_WRITE_END(); \ -+ } while (0) -+ -+// End of a syntax element which is made up of subelements which are -+// aleady traced, so we are only showing the value. This forges a -+// PutBitContext to point to the position of the start of the syntax -+// element, but the other state doesn't matter because length is zero. -+#define CBS_TRACE_WRITE_END_VALUE_ONLY() \ -+ do { \ -+ if (ctx->trace_enable) { \ -+ PutBitContext tmp; \ -+ init_put_bits(&tmp, pbc->buf, start_position); \ -+ skip_put_bits(&tmp, start_position); \ -+ ctx->trace_write_callback(ctx->trace_context, &tmp, 0, \ -+ name, subscripts, value); \ -+ } \ -+ } while (0) -+ - #define TYPE_LIST(...) { __VA_ARGS__ } - #define CBS_UNIT_TYPE_POD(type_, structure) { \ - .nb_unit_types = 1, \ -diff --git a/libavcodec/cbs_mpeg2.c b/libavcodec/cbs_mpeg2.c -index 04b0c7f..37fc28a 100644 ---- a/libavcodec/cbs_mpeg2.c -+++ b/libavcodec/cbs_mpeg2.c -@@ -40,8 +40,6 @@ - - #define SUBSCRIPTS(subs, ...) (subs > 0 ? ((int[subs + 1]){ subs, __VA_ARGS__ }) : NULL) - --#define ui(width, name) \ -- xui(width, name, current->name, 0, MAX_UINT_BITS(width), 0, ) - #define uir(width, name) \ - xui(width, name, current->name, 1, MAX_UINT_BITS(width), 0, ) - #define uis(width, name, subs, ...) \ -@@ -65,6 +63,12 @@ - #define READWRITE read - #define RWContext GetBitContext - -+#define ui(width, name) do { \ -+ uint32_t value; \ -+ CHECK(ff_cbs_read_simple_unsigned(ctx, rw, width, #name, \ -+ &value)); \ -+ current->name = value; \ -+ } while (0) - #define xuia(width, string, var, range_min, range_max, subs, ...) do { \ - uint32_t value; \ - CHECK(ff_cbs_read_unsigned(ctx, rw, width, string, \ -@@ -95,6 +99,7 @@ - #undef READ - #undef READWRITE - #undef RWContext -+#undef ui - #undef xuia - #undef xsi - #undef nextbits -@@ -105,6 +110,11 @@ - #define READWRITE write - #define RWContext PutBitContext - -+#define ui(width, name) do { \ -+ CHECK(ff_cbs_write_simple_unsigned(ctx, rw, width, #name, \ -+ current->name)); \ -+ } while (0) -+ - #define xuia(width, string, var, range_min, range_max, subs, ...) do { \ - CHECK(ff_cbs_write_unsigned(ctx, rw, width, string, \ - SUBSCRIPTS(subs, __VA_ARGS__), \ -@@ -134,6 +144,7 @@ - #undef WRITE - #undef READWRITE - #undef RWContext -+#undef ui - #undef xuia - #undef xsi - #undef nextbits -diff --git a/libavcodec/cbs_vp9.c b/libavcodec/cbs_vp9.c -index 184fdca..816d06d 100644 ---- a/libavcodec/cbs_vp9.c -+++ b/libavcodec/cbs_vp9.c -@@ -28,11 +28,10 @@ static int cbs_vp9_read_s(CodedBitstreamContext *ctx, GetBitContext *gbc, - const int *subscripts, int32_t *write_to) - { - uint32_t magnitude; -- int position, sign; -+ int sign; - int32_t value; - -- if (ctx->trace_enable) -- position = get_bits_count(gbc); -+ CBS_TRACE_READ_START(); - - if (get_bits_left(gbc) < width + 1) { - av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid signed value at " -@@ -44,17 +43,7 @@ static int cbs_vp9_read_s(CodedBitstreamContext *ctx, GetBitContext *gbc, - sign = get_bits1(gbc); - value = sign ? -(int32_t)magnitude : magnitude; - -- if (ctx->trace_enable) { -- char bits[33]; -- int i; -- for (i = 0; i < width; i++) -- bits[i] = magnitude >> (width - i - 1) & 1 ? '1' : '0'; -- bits[i] = sign ? '1' : '0'; -- bits[i + 1] = 0; -- -- ff_cbs_trace_syntax_element(ctx, position, name, subscripts, -- bits, value); -- } -+ CBS_TRACE_READ_END(); - - *write_to = value; - return 0; -@@ -67,27 +56,19 @@ static int cbs_vp9_write_s(CodedBitstreamContext *ctx, PutBitContext *pbc, - uint32_t magnitude; - int sign; - -+ CBS_TRACE_WRITE_START(); -+ - if (put_bits_left(pbc) < width + 1) - return AVERROR(ENOSPC); - - sign = value < 0; - magnitude = sign ? -value : value; - -- if (ctx->trace_enable) { -- char bits[33]; -- int i; -- for (i = 0; i < width; i++) -- bits[i] = magnitude >> (width - i - 1) & 1 ? '1' : '0'; -- bits[i] = sign ? '1' : '0'; -- bits[i + 1] = 0; -- -- ff_cbs_trace_syntax_element(ctx, put_bits_count(pbc), -- name, subscripts, bits, value); -- } -- - put_bits(pbc, width, magnitude); - put_bits(pbc, 1, sign); - -+ CBS_TRACE_WRITE_END(); -+ - return 0; - } - -@@ -96,32 +77,24 @@ static int cbs_vp9_read_increment(CodedBitstreamContext *ctx, GetBitContext *gbc - const char *name, uint32_t *write_to) - { - uint32_t value; -- int position, i; -- char bits[8]; - -- av_assert0(range_min <= range_max && range_max - range_min < sizeof(bits) - 1); -- if (ctx->trace_enable) -- position = get_bits_count(gbc); -+ CBS_TRACE_READ_START(); -+ -+ av_assert0(range_min <= range_max && range_max - range_min < 32); - -- for (i = 0, value = range_min; value < range_max;) { -+ for (value = range_min; value < range_max;) { - if (get_bits_left(gbc) < 1) { - av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid increment value at " - "%s: bitstream ended.\n", name); - return AVERROR_INVALIDDATA; - } -- if (get_bits1(gbc)) { -- bits[i++] = '1'; -+ if (get_bits1(gbc)) - ++value; -- } else { -- bits[i++] = '0'; -+ else - break; -- } - } - -- if (ctx->trace_enable) { -- bits[i] = 0; -- ff_cbs_trace_syntax_element(ctx, position, name, NULL, bits, value); -- } -+ CBS_TRACE_READ_END_NO_SUBSCRIPTS(); - - *write_to = value; - return 0; -@@ -133,6 +106,8 @@ static int cbs_vp9_write_increment(CodedBitstreamContext *ctx, PutBitContext *pb - { - int len; - -+ CBS_TRACE_WRITE_START(); -+ - av_assert0(range_min <= range_max && range_max - range_min < 8); - if (value < range_min || value > range_max) { - av_log(ctx->log_ctx, AV_LOG_ERROR, "%s out of range: " -@@ -148,23 +123,11 @@ static int cbs_vp9_write_increment(CodedBitstreamContext *ctx, PutBitContext *pb - if (put_bits_left(pbc) < len) - return AVERROR(ENOSPC); - -- if (ctx->trace_enable) { -- char bits[8]; -- int i; -- for (i = 0; i < len; i++) { -- if (range_min + i == value) -- bits[i] = '0'; -- else -- bits[i] = '1'; -- } -- bits[i] = 0; -- ff_cbs_trace_syntax_element(ctx, put_bits_count(pbc), -- name, NULL, bits, value); -- } -- - if (len > 0) - put_bits(pbc, len, (1 << len) - 1 - (value != range_max)); - -+ CBS_TRACE_WRITE_END_NO_SUBSCRIPTS(); -+ - return 0; - } - -@@ -173,12 +136,11 @@ static int cbs_vp9_read_le(CodedBitstreamContext *ctx, GetBitContext *gbc, - const int *subscripts, uint32_t *write_to) - { - uint32_t value; -- int position, b; -+ int b; - -- av_assert0(width % 8 == 0); -+ CBS_TRACE_READ_START(); - -- if (ctx->trace_enable) -- position = get_bits_count(gbc); -+ av_assert0(width % 8 == 0); - - if (get_bits_left(gbc) < width) { - av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid le value at " -@@ -190,17 +152,7 @@ static int cbs_vp9_read_le(CodedBitstreamContext *ctx, GetBitContext *gbc, - for (b = 0; b < width; b += 8) - value |= get_bits(gbc, 8) << b; - -- if (ctx->trace_enable) { -- char bits[33]; -- int i; -- for (b = 0; b < width; b += 8) -- for (i = 0; i < 8; i++) -- bits[b + i] = value >> (b + i) & 1 ? '1' : '0'; -- bits[b] = 0; -- -- ff_cbs_trace_syntax_element(ctx, position, name, subscripts, -- bits, value); -- } -+ CBS_TRACE_READ_END(); - - *write_to = value; - return 0; -@@ -212,26 +164,18 @@ static int cbs_vp9_write_le(CodedBitstreamContext *ctx, PutBitContext *pbc, - { - int b; - -+ CBS_TRACE_WRITE_START(); -+ - av_assert0(width % 8 == 0); - - if (put_bits_left(pbc) < width) - return AVERROR(ENOSPC); - -- if (ctx->trace_enable) { -- char bits[33]; -- int i; -- for (b = 0; b < width; b += 8) -- for (i = 0; i < 8; i++) -- bits[b + i] = value >> (b + i) & 1 ? '1' : '0'; -- bits[b] = 0; -- -- ff_cbs_trace_syntax_element(ctx, put_bits_count(pbc), -- name, subscripts, bits, value); -- } -- - for (b = 0; b < width; b += 8) - put_bits(pbc, 8, value >> b & 0xff); - -+ CBS_TRACE_WRITE_END(); -+ - return 0; - } - -@@ -251,8 +195,6 @@ static int cbs_vp9_write_le(CodedBitstreamContext *ctx, PutBitContext *pbc, - - #define SUBSCRIPTS(subs, ...) (subs > 0 ? ((int[subs + 1]){ subs, __VA_ARGS__ }) : NULL) - --#define f(width, name) \ -- xf(width, name, current->name, 0, ) - #define s(width, name) \ - xs(width, name, current->name, 0, ) - #define fs(width, name, subs, ...) \ -@@ -264,6 +206,12 @@ static int cbs_vp9_write_le(CodedBitstreamContext *ctx, PutBitContext *pbc, - #define READWRITE read - #define RWContext GetBitContext - -+#define f(width, name) do { \ -+ uint32_t value; \ -+ CHECK(ff_cbs_read_simple_unsigned(ctx, rw, width, #name, \ -+ &value)); \ -+ current->name = value; \ -+ } while (0) - #define xf(width, name, var, subs, ...) do { \ - uint32_t value; \ - CHECK(ff_cbs_read_unsigned(ctx, rw, width, #name, \ -@@ -329,6 +277,7 @@ static int cbs_vp9_write_le(CodedBitstreamContext *ctx, PutBitContext *pbc, - #undef READ - #undef READWRITE - #undef RWContext -+#undef f - #undef xf - #undef xs - #undef increment -@@ -344,6 +293,10 @@ static int cbs_vp9_write_le(CodedBitstreamContext *ctx, PutBitContext *pbc, - #define READWRITE write - #define RWContext PutBitContext - -+#define f(width, name) do { \ -+ CHECK(ff_cbs_write_simple_unsigned(ctx, rw, width, #name, \ -+ current->name)); \ -+ } while (0) - #define xf(width, name, var, subs, ...) do { \ - CHECK(ff_cbs_write_unsigned(ctx, rw, width, #name, \ - SUBSCRIPTS(subs, __VA_ARGS__), \ -@@ -396,6 +349,7 @@ static int cbs_vp9_write_le(CodedBitstreamContext *ctx, PutBitContext *pbc, - #undef WRITE - #undef READWRITE - #undef RWContext -+#undef f - #undef xf - #undef xs - #undef increment -diff --git a/libavcodec/extract_extradata_bsf.c b/libavcodec/extract_extradata_bsf.c -index 329b1a6..7eedb16 100644 ---- a/libavcodec/extract_extradata_bsf.c -+++ b/libavcodec/extract_extradata_bsf.c -@@ -48,10 +48,9 @@ typedef struct ExtractExtradataContext { - int remove; - } ExtractExtradataContext; - --static int val_in_array(const int *arr, int len, int val) -+static int val_in_array(const int *arr, size_t len, int val) - { -- int i; -- for (i = 0; i < len; i++) -+ for (size_t i = 0; i < len; i++) - if (arr[i] == val) - return 1; - return 0; -@@ -145,7 +144,7 @@ static int extract_extradata_h2645(AVBSFContext *ctx, AVPacket *pkt, - - int extradata_size = 0, filtered_size = 0; - const int *extradata_nal_types; -- int nb_extradata_nal_types; -+ size_t nb_extradata_nal_types; - int i, has_sps = 0, has_vps = 0, ret = 0; - - if (ctx->par_in->codec_id == AV_CODEC_ID_HEVC) { -diff --git a/libavcodec/trace_headers_bsf.c b/libavcodec/trace_headers_bsf.c -index 028b0a1..8781f5f 100644 ---- a/libavcodec/trace_headers_bsf.c -+++ b/libavcodec/trace_headers_bsf.c -@@ -44,6 +44,8 @@ static int trace_headers_init(AVBSFContext *bsf) - - ctx->cbc->trace_enable = 1; - ctx->cbc->trace_level = AV_LOG_INFO; -+ ctx->cbc->trace_context = ctx->cbc; -+ ctx->cbc->trace_read_callback = ff_cbs_trace_read_log; - - if (bsf->par_in->extradata) { - CodedBitstreamFragment *frag = &ctx->fragment; -diff --git a/libavcodec/vaapi_encode.c b/libavcodec/vaapi_encode.c -index bfca315..f5bf5ab 100644 ---- a/libavcodec/vaapi_encode.c -+++ b/libavcodec/vaapi_encode.c -@@ -276,21 +276,34 @@ static int vaapi_encode_issue(AVCodecContext *avctx, - av_log(avctx, AV_LOG_DEBUG, "Issuing encode for pic %"PRId64"/%"PRId64" " - "as type %s.\n", pic->display_order, pic->encode_order, - picture_type_name[pic->type]); -- if (pic->nb_refs == 0) { -+ if (pic->nb_refs[0] == 0 && pic->nb_refs[1] == 0) { - av_log(avctx, AV_LOG_DEBUG, "No reference pictures.\n"); - } else { -- av_log(avctx, AV_LOG_DEBUG, "Refers to:"); -- for (i = 0; i < pic->nb_refs; i++) { -+ av_log(avctx, AV_LOG_DEBUG, "L0 refers to"); -+ for (i = 0; i < pic->nb_refs[0]; i++) { - av_log(avctx, AV_LOG_DEBUG, " %"PRId64"/%"PRId64, -- pic->refs[i]->display_order, pic->refs[i]->encode_order); -+ pic->refs[0][i]->display_order, pic->refs[0][i]->encode_order); - } - av_log(avctx, AV_LOG_DEBUG, ".\n"); -+ -+ if (pic->nb_refs[1]) { -+ av_log(avctx, AV_LOG_DEBUG, "L1 refers to"); -+ for (i = 0; i < pic->nb_refs[1]; i++) { -+ av_log(avctx, AV_LOG_DEBUG, " %"PRId64"/%"PRId64, -+ pic->refs[1][i]->display_order, pic->refs[1][i]->encode_order); -+ } -+ av_log(avctx, AV_LOG_DEBUG, ".\n"); -+ } - } - - av_assert0(!pic->encode_issued); -- for (i = 0; i < pic->nb_refs; i++) { -- av_assert0(pic->refs[i]); -- av_assert0(pic->refs[i]->encode_issued); -+ for (i = 0; i < pic->nb_refs[0]; i++) { -+ av_assert0(pic->refs[0][i]); -+ av_assert0(pic->refs[0][i]->encode_issued); -+ } -+ for (i = 0; i < pic->nb_refs[1]; i++) { -+ av_assert0(pic->refs[1][i]); -+ av_assert0(pic->refs[1][i]->encode_issued); - } - - av_log(avctx, AV_LOG_DEBUG, "Input surface is %#x.\n", pic->input_surface); -@@ -650,79 +663,200 @@ fail_at_end: - return err; - } - --static int vaapi_encode_output(AVCodecContext *avctx, -- VAAPIEncodePicture *pic, AVPacket *pkt) -+static int vaapi_encode_set_output_property(AVCodecContext *avctx, -+ VAAPIEncodePicture *pic, -+ AVPacket *pkt) -+{ -+ VAAPIEncodeContext *ctx = avctx->priv_data; -+ -+ if (pic->type == PICTURE_TYPE_IDR) -+ pkt->flags |= AV_PKT_FLAG_KEY; -+ -+ pkt->pts = pic->pts; -+ pkt->duration = pic->duration; -+ -+ // for no-delay encoders this is handled in generic codec -+ if (avctx->codec->capabilities & AV_CODEC_CAP_DELAY && -+ avctx->flags & AV_CODEC_FLAG_COPY_OPAQUE) { -+ pkt->opaque = pic->opaque; -+ pkt->opaque_ref = pic->opaque_ref; -+ pic->opaque_ref = NULL; -+ } -+ -+ if (ctx->codec->flags & FLAG_TIMESTAMP_NO_DELAY) { -+ pkt->dts = pkt->pts; -+ return 0; -+ } -+ -+ if (ctx->output_delay == 0) { -+ pkt->dts = pkt->pts; -+ } else if (pic->encode_order < ctx->decode_delay) { -+ if (ctx->ts_ring[pic->encode_order] < INT64_MIN + ctx->dts_pts_diff) -+ pkt->dts = INT64_MIN; -+ else -+ pkt->dts = ctx->ts_ring[pic->encode_order] - ctx->dts_pts_diff; -+ } else { -+ pkt->dts = ctx->ts_ring[(pic->encode_order - ctx->decode_delay) % -+ (3 * ctx->output_delay + ctx->async_depth)]; -+ } -+ -+ return 0; -+} -+ -+static int vaapi_encode_get_coded_buffer_size(AVCodecContext *avctx, VABufferID buf_id) - { - VAAPIEncodeContext *ctx = avctx->priv_data; - VACodedBufferSegment *buf_list, *buf; -+ int size = 0; - VAStatus vas; -- int total_size = 0; -- uint8_t *ptr; - int err; - -- err = vaapi_encode_wait(avctx, pic); -- if (err < 0) -- return err; -- -- buf_list = NULL; -- vas = vaMapBuffer(ctx->hwctx->display, pic->output_buffer, -+ vas = vaMapBuffer(ctx->hwctx->display, buf_id, - (void**)&buf_list); - if (vas != VA_STATUS_SUCCESS) { - av_log(avctx, AV_LOG_ERROR, "Failed to map output buffers: " - "%d (%s).\n", vas, vaErrorStr(vas)); - err = AVERROR(EIO); -- goto fail; -+ return err; - } - - for (buf = buf_list; buf; buf = buf->next) -- total_size += buf->size; -+ size += buf->size; - -- err = ff_get_encode_buffer(avctx, pkt, total_size, 0); -- ptr = pkt->data; -+ vas = vaUnmapBuffer(ctx->hwctx->display, buf_id); -+ if (vas != VA_STATUS_SUCCESS) { -+ av_log(avctx, AV_LOG_ERROR, "Failed to unmap output buffers: " -+ "%d (%s).\n", vas, vaErrorStr(vas)); -+ err = AVERROR(EIO); -+ return err; -+ } - -- if (err < 0) -- goto fail_mapped; -+ return size; -+} -+ -+static int vaapi_encode_get_coded_buffer_data(AVCodecContext *avctx, -+ VABufferID buf_id, uint8_t **dst) -+{ -+ VAAPIEncodeContext *ctx = avctx->priv_data; -+ VACodedBufferSegment *buf_list, *buf; -+ VAStatus vas; -+ int err; -+ -+ vas = vaMapBuffer(ctx->hwctx->display, buf_id, -+ (void**)&buf_list); -+ if (vas != VA_STATUS_SUCCESS) { -+ av_log(avctx, AV_LOG_ERROR, "Failed to map output buffers: " -+ "%d (%s).\n", vas, vaErrorStr(vas)); -+ err = AVERROR(EIO); -+ return err; -+ } - - for (buf = buf_list; buf; buf = buf->next) { - av_log(avctx, AV_LOG_DEBUG, "Output buffer: %u bytes " - "(status %08x).\n", buf->size, buf->status); - -- memcpy(ptr, buf->buf, buf->size); -- ptr += buf->size; -+ memcpy(*dst, buf->buf, buf->size); -+ *dst += buf->size; - } - -- if (pic->type == PICTURE_TYPE_IDR) -- pkt->flags |= AV_PKT_FLAG_KEY; -- -- pkt->pts = pic->pts; -- pkt->duration = pic->duration; -- -- vas = vaUnmapBuffer(ctx->hwctx->display, pic->output_buffer); -+ vas = vaUnmapBuffer(ctx->hwctx->display, buf_id); - if (vas != VA_STATUS_SUCCESS) { - av_log(avctx, AV_LOG_ERROR, "Failed to unmap output buffers: " - "%d (%s).\n", vas, vaErrorStr(vas)); - err = AVERROR(EIO); -- goto fail; -+ return err; - } - -- // for no-delay encoders this is handled in generic codec -- if (avctx->codec->capabilities & AV_CODEC_CAP_DELAY && -- avctx->flags & AV_CODEC_FLAG_COPY_OPAQUE) { -- pkt->opaque = pic->opaque; -- pkt->opaque_ref = pic->opaque_ref; -- pic->opaque_ref = NULL; -+ return 0; -+} -+ -+static int vaapi_encode_get_coded_data(AVCodecContext *avctx, -+ VAAPIEncodePicture *pic, AVPacket *pkt) -+{ -+ VAAPIEncodeContext *ctx = avctx->priv_data; -+ VABufferID output_buffer_prev; -+ int total_size = 0; -+ uint8_t *ptr; -+ int ret; -+ -+ if (ctx->coded_buffer_ref) { -+ output_buffer_prev = (VABufferID)(uintptr_t)ctx->coded_buffer_ref->data; -+ ret = vaapi_encode_get_coded_buffer_size(avctx, output_buffer_prev); -+ if (ret < 0) -+ goto end; -+ total_size += ret; -+ } -+ -+ ret = vaapi_encode_get_coded_buffer_size(avctx, pic->output_buffer); -+ if (ret < 0) -+ goto end; -+ total_size += ret; -+ -+ ret = ff_get_encode_buffer(avctx, pkt, total_size, 0); -+ if (ret < 0) -+ goto end; -+ ptr = pkt->data; -+ -+ if (ctx->coded_buffer_ref) { -+ ret = vaapi_encode_get_coded_buffer_data(avctx, output_buffer_prev, &ptr); -+ if (ret < 0) -+ goto end; - } - -+ ret = vaapi_encode_get_coded_buffer_data(avctx, pic->output_buffer, &ptr); -+ if (ret < 0) -+ goto end; -+ -+end: -+ if (ctx->coded_buffer_ref) { -+ av_buffer_unref(&ctx->coded_buffer_ref); -+ } - av_buffer_unref(&pic->output_buffer_ref); - pic->output_buffer = VA_INVALID_ID; - -+ return ret; -+} -+ -+static int vaapi_encode_output(AVCodecContext *avctx, -+ VAAPIEncodePicture *pic, AVPacket *pkt) -+{ -+ VAAPIEncodeContext *ctx = avctx->priv_data; -+ AVPacket *pkt_ptr = pkt; -+ int err; -+ -+ err = vaapi_encode_wait(avctx, pic); -+ if (err < 0) -+ return err; -+ -+ if (pic->non_independent_frame) { -+ av_assert0(!ctx->coded_buffer_ref); -+ ctx->coded_buffer_ref = av_buffer_ref(pic->output_buffer_ref); -+ -+ if (pic->tail_size) { -+ if (ctx->tail_pkt->size) { -+ err = AVERROR(AVERROR_BUG); -+ goto end; -+ } -+ -+ err = ff_get_encode_buffer(avctx, ctx->tail_pkt, pic->tail_size, 0); -+ if (err < 0) -+ goto end; -+ -+ memcpy(ctx->tail_pkt->data, pic->tail_data, pic->tail_size); -+ pkt_ptr = ctx->tail_pkt; -+ } -+ } else { -+ err = vaapi_encode_get_coded_data(avctx, pic, pkt); -+ if (err < 0) -+ goto end; -+ } -+ - av_log(avctx, AV_LOG_DEBUG, "Output read for pic %"PRId64"/%"PRId64".\n", - pic->display_order, pic->encode_order); -- return 0; - --fail_mapped: -- vaUnmapBuffer(ctx->hwctx->display, pic->output_buffer); --fail: -+ vaapi_encode_set_output_property(avctx, pic, pkt_ptr); -+ -+end: - av_buffer_unref(&pic->output_buffer_ref); - pic->output_buffer = VA_INVALID_ID; - return err; -@@ -811,8 +945,12 @@ static void vaapi_encode_add_ref(AVCodecContext *avctx, - - if (is_ref) { - av_assert0(pic != target); -- av_assert0(pic->nb_refs < MAX_PICTURE_REFERENCES); -- pic->refs[pic->nb_refs++] = target; -+ av_assert0(pic->nb_refs[0] < MAX_PICTURE_REFERENCES && -+ pic->nb_refs[1] < MAX_PICTURE_REFERENCES); -+ if (target->display_order < pic->display_order) -+ pic->refs[0][pic->nb_refs[0]++] = target; -+ else -+ pic->refs[1][pic->nb_refs[1]++] = target; - ++refs; - } - -@@ -841,10 +979,16 @@ static void vaapi_encode_remove_refs(AVCodecContext *avctx, - if (pic->ref_removed[level]) - return; - -- for (i = 0; i < pic->nb_refs; i++) { -- av_assert0(pic->refs[i]); -- --pic->refs[i]->ref_count[level]; -- av_assert0(pic->refs[i]->ref_count[level] >= 0); -+ for (i = 0; i < pic->nb_refs[0]; i++) { -+ av_assert0(pic->refs[0][i]); -+ --pic->refs[0][i]->ref_count[level]; -+ av_assert0(pic->refs[0][i]->ref_count[level] >= 0); -+ } -+ -+ for (i = 0; i < pic->nb_refs[1]; i++) { -+ av_assert0(pic->refs[1][i]); -+ --pic->refs[1][i]->ref_count[level]; -+ av_assert0(pic->refs[1][i]->ref_count[level] >= 0); - } - - for (i = 0; i < pic->nb_dpb_pics; i++) { -@@ -889,7 +1033,7 @@ static void vaapi_encode_set_b_pictures(AVCodecContext *avctx, - vaapi_encode_add_ref(avctx, pic, end, 1, 1, 0); - vaapi_encode_add_ref(avctx, pic, prev, 0, 0, 1); - -- for (ref = end->refs[1]; ref; ref = ref->refs[1]) -+ for (ref = end->refs[1][0]; ref; ref = ref->refs[1][0]) - vaapi_encode_add_ref(avctx, pic, ref, 0, 1, 0); - } - *last = prev; -@@ -912,7 +1056,7 @@ static void vaapi_encode_set_b_pictures(AVCodecContext *avctx, - vaapi_encode_add_ref(avctx, pic, end, 1, 1, 0); - vaapi_encode_add_ref(avctx, pic, prev, 0, 0, 1); - -- for (ref = end->refs[1]; ref; ref = ref->refs[1]) -+ for (ref = end->refs[1][0]; ref; ref = ref->refs[1][0]) - vaapi_encode_add_ref(avctx, pic, ref, 0, 1, 0); - - if (i > 1) -@@ -926,11 +1070,44 @@ static void vaapi_encode_set_b_pictures(AVCodecContext *avctx, - } - } - -+static void vaapi_encode_add_next_prev(AVCodecContext *avctx, -+ VAAPIEncodePicture *pic) -+{ -+ VAAPIEncodeContext *ctx = avctx->priv_data; -+ int i; -+ -+ if (!pic) -+ return; -+ -+ if (pic->type == PICTURE_TYPE_IDR) { -+ for (i = 0; i < ctx->nb_next_prev; i++) { -+ --ctx->next_prev[i]->ref_count[0]; -+ ctx->next_prev[i] = NULL; -+ } -+ ctx->next_prev[0] = pic; -+ ++pic->ref_count[0]; -+ ctx->nb_next_prev = 1; -+ -+ return; -+ } -+ -+ if (ctx->nb_next_prev < MAX_PICTURE_REFERENCES) { -+ ctx->next_prev[ctx->nb_next_prev++] = pic; -+ ++pic->ref_count[0]; -+ } else { -+ --ctx->next_prev[0]->ref_count[0]; -+ for (i = 0; i < MAX_PICTURE_REFERENCES - 1; i++) -+ ctx->next_prev[i] = ctx->next_prev[i + 1]; -+ ctx->next_prev[i] = pic; -+ ++pic->ref_count[0]; -+ } -+} -+ - static int vaapi_encode_pick_next(AVCodecContext *avctx, - VAAPIEncodePicture **pic_out) - { - VAAPIEncodeContext *ctx = avctx->priv_data; -- VAAPIEncodePicture *pic = NULL, *next, *start; -+ VAAPIEncodePicture *pic = NULL, *prev = NULL, *next, *start; - int i, b_counter, closed_gop_end; - - // If there are any B-frames already queued, the next one to encode -@@ -941,11 +1118,18 @@ static int vaapi_encode_pick_next(AVCodecContext *avctx, - continue; - if (pic->type != PICTURE_TYPE_B) - continue; -- for (i = 0; i < pic->nb_refs; i++) { -- if (!pic->refs[i]->encode_issued) -+ for (i = 0; i < pic->nb_refs[0]; i++) { -+ if (!pic->refs[0][i]->encode_issued) -+ break; -+ } -+ if (i != pic->nb_refs[0]) -+ continue; -+ -+ for (i = 0; i < pic->nb_refs[1]; i++) { -+ if (!pic->refs[1][i]->encode_issued) - break; - } -- if (i == pic->nb_refs) -+ if (i == pic->nb_refs[1]) - break; - } - -@@ -1044,21 +1228,30 @@ static int vaapi_encode_pick_next(AVCodecContext *avctx, - - vaapi_encode_add_ref(avctx, pic, pic, 0, 1, 0); - if (pic->type != PICTURE_TYPE_IDR) { -- vaapi_encode_add_ref(avctx, pic, start, -- pic->type == PICTURE_TYPE_P, -- b_counter > 0, 0); -- vaapi_encode_add_ref(avctx, pic, ctx->next_prev, 0, 0, 1); -+ // TODO: apply both previous and forward multi reference for all vaapi encoders. -+ // And L0/L1 reference frame number can be set dynamically through query -+ // VAConfigAttribEncMaxRefFrames attribute. -+ if (avctx->codec_id == AV_CODEC_ID_AV1) { -+ for (i = 0; i < ctx->nb_next_prev; i++) -+ vaapi_encode_add_ref(avctx, pic, ctx->next_prev[i], -+ pic->type == PICTURE_TYPE_P, -+ b_counter > 0, 0); -+ } else -+ vaapi_encode_add_ref(avctx, pic, start, -+ pic->type == PICTURE_TYPE_P, -+ b_counter > 0, 0); -+ -+ vaapi_encode_add_ref(avctx, pic, ctx->next_prev[ctx->nb_next_prev - 1], 0, 0, 1); - } -- if (ctx->next_prev) -- --ctx->next_prev->ref_count[0]; - - if (b_counter > 0) { - vaapi_encode_set_b_pictures(avctx, start, pic, pic, 1, -- &ctx->next_prev); -+ &prev); - } else { -- ctx->next_prev = pic; -+ prev = pic; - } -- ++ctx->next_prev->ref_count[0]; -+ vaapi_encode_add_next_prev(avctx, prev); -+ - return 0; - } - -@@ -1205,10 +1398,23 @@ fail: - int ff_vaapi_encode_receive_packet(AVCodecContext *avctx, AVPacket *pkt) - { - VAAPIEncodeContext *ctx = avctx->priv_data; -- VAAPIEncodePicture *pic; -+ VAAPIEncodePicture *pic = NULL; - AVFrame *frame = ctx->frame; - int err; - -+start: -+ /** if no B frame before repeat P frame, sent repeat P frame out. */ -+ if (ctx->tail_pkt->size) { -+ for (VAAPIEncodePicture *tmp = ctx->pic_start; tmp; tmp = tmp->next) { -+ if (tmp->type == PICTURE_TYPE_B && tmp->pts < ctx->tail_pkt->pts) -+ break; -+ else if (!tmp->next) { -+ av_packet_move_ref(pkt, ctx->tail_pkt); -+ goto end; -+ } -+ } -+ } -+ - err = ff_encode_get_frame(avctx, frame); - if (err < 0 && err != AVERROR_EOF) - return err; -@@ -1228,8 +1434,6 @@ int ff_vaapi_encode_receive_packet(AVCodecContext *avctx, AVPacket *pkt) - } - - if (ctx->has_sync_buffer_func) { -- pic = NULL; -- - if (av_fifo_can_write(ctx->encode_fifo)) { - err = vaapi_encode_pick_next(avctx, &pic); - if (!err) { -@@ -1255,7 +1459,6 @@ int ff_vaapi_encode_receive_packet(AVCodecContext *avctx, AVPacket *pkt) - av_fifo_read(ctx->encode_fifo, &pic, 1); - ctx->encode_order = pic->encode_order + 1; - } else { -- pic = NULL; - err = vaapi_encode_pick_next(avctx, &pic); - if (err < 0) - return err; -@@ -1276,27 +1479,21 @@ int ff_vaapi_encode_receive_packet(AVCodecContext *avctx, AVPacket *pkt) - return err; - } - -- if (ctx->output_delay == 0) { -- pkt->dts = pkt->pts; -- } else if (pic->encode_order < ctx->decode_delay) { -- if (ctx->ts_ring[pic->encode_order] < INT64_MIN + ctx->dts_pts_diff) -- pkt->dts = INT64_MIN; -- else -- pkt->dts = ctx->ts_ring[pic->encode_order] - ctx->dts_pts_diff; -- } else { -- pkt->dts = ctx->ts_ring[(pic->encode_order - ctx->decode_delay) % -- (3 * ctx->output_delay + ctx->async_depth)]; -- } -- av_log(avctx, AV_LOG_DEBUG, "Output packet: pts %"PRId64" dts %"PRId64".\n", -- pkt->pts, pkt->dts); -- - ctx->output_order = pic->encode_order; - vaapi_encode_clear_old(avctx); - -+ /** loop to get an available pkt in encoder flushing. */ -+ if (ctx->end_of_stream && !pkt->size) -+ goto start; -+ -+end: -+ if (pkt->size) -+ av_log(avctx, AV_LOG_DEBUG, "Output packet: pts %"PRId64", dts %"PRId64", " -+ "size %d bytes.\n", pkt->pts, pkt->dts, pkt->size); -+ - return 0; - } - -- - static av_cold void vaapi_encode_add_global_param(AVCodecContext *avctx, int type, - void *buffer, size_t size) - { -@@ -2597,6 +2794,12 @@ av_cold int ff_vaapi_encode_init(AVCodecContext *avctx) - ctx->device = (AVHWDeviceContext*)ctx->device_ref->data; - ctx->hwctx = ctx->device->hwctx; - -+ ctx->tail_pkt = av_packet_alloc(); -+ if (!ctx->tail_pkt) { -+ err = AVERROR(ENOMEM); -+ goto fail; -+ } -+ - err = vaapi_encode_profile_entrypoint(avctx); - if (err < 0) - goto fail; -@@ -2789,6 +2992,7 @@ av_cold int ff_vaapi_encode_close(AVCodecContext *avctx) - } - - av_frame_free(&ctx->frame); -+ av_packet_free(&ctx->tail_pkt); - - av_freep(&ctx->codec_sequence_params); - av_freep(&ctx->codec_picture_params); -diff --git a/libavcodec/vaapi_encode.h b/libavcodec/vaapi_encode.h -index a1e639f..416a3ce 100644 ---- a/libavcodec/vaapi_encode.h -+++ b/libavcodec/vaapi_encode.h -@@ -49,6 +49,7 @@ enum { - // A.4.1: table A.6 allows at most 20 tile columns for any level. - MAX_TILE_COLS = 20, - MAX_ASYNC_DEPTH = 64, -+ MAX_REFERENCE_LIST_NUM = 2, - }; - - extern const AVCodecHWConfigInternal *const ff_vaapi_encode_hw_configs[]; -@@ -116,10 +117,11 @@ typedef struct VAAPIEncodePicture { - // but not if it isn't. - int nb_dpb_pics; - struct VAAPIEncodePicture *dpb[MAX_DPB_SIZE]; -- // The reference pictures used in decoding this picture. If they are -- // used by later pictures they will also appear in the DPB. -- int nb_refs; -- struct VAAPIEncodePicture *refs[MAX_PICTURE_REFERENCES]; -+ // The reference pictures used in decoding this picture. If they are -+ // used by later pictures they will also appear in the DPB. ref[0][] for -+ // previous reference frames. ref[1][] for future reference frames. -+ int nb_refs[MAX_REFERENCE_LIST_NUM]; -+ struct VAAPIEncodePicture *refs[MAX_REFERENCE_LIST_NUM][MAX_PICTURE_REFERENCES]; - // The previous reference picture in encode order. Must be in at least - // one of the reference list and DPB list. - struct VAAPIEncodePicture *prev; -@@ -131,6 +133,17 @@ typedef struct VAAPIEncodePicture { - - int nb_slices; - VAAPIEncodeSlice *slices; -+ -+ /** -+ * indicate if current frame is an independent frame that the coded data -+ * can be pushed to downstream directly. Coded of non-independent frame -+ * data will be concatenated into next independent frame. -+ */ -+ int non_independent_frame; -+ /** Tail data of current pic, used only for repeat header of AV1. */ -+ char tail_data[MAX_PARAM_BUFFER_SIZE]; -+ /** Byte length of tail_data. */ -+ size_t tail_size; - } VAAPIEncodePicture; - - typedef struct VAAPIEncodeProfile { -@@ -290,8 +303,9 @@ typedef struct VAAPIEncodeContext { - // Current encoding window, in display (input) order. - VAAPIEncodePicture *pic_start, *pic_end; - // The next picture to use as the previous reference picture in -- // encoding order. -- VAAPIEncodePicture *next_prev; -+ // encoding order. Order from small to large in encoding order. -+ VAAPIEncodePicture *next_prev[MAX_PICTURE_REFERENCES]; -+ int nb_next_prev; - - // Next input order index (display order). - int64_t input_order; -@@ -364,6 +378,16 @@ typedef struct VAAPIEncodeContext { - AVFifo *encode_fifo; - // Max number of frame buffered in encoder. - int async_depth; -+ -+ /** Head data for current output pkt, used only for AV1. */ -+ //void *header_data; -+ //size_t header_data_size; -+ -+ /** Buffered coded data of a pic if it is an non-independent frame. */ -+ AVBufferRef *coded_buffer_ref; -+ -+ /** Tail data of a pic, now only used for av1 repeat frame header. */ -+ AVPacket *tail_pkt; - } VAAPIEncodeContext; - - enum { -@@ -380,6 +404,9 @@ enum { - // Codec supports non-IDR key pictures (that is, key pictures do - // not necessarily empty the DPB). - FLAG_NON_IDR_KEY_PICTURES = 1 << 5, -+ // Codec output packet without timestamp delay, which means the -+ // output packet has same PTS and DTS. -+ FLAG_TIMESTAMP_NO_DELAY = 1 << 6, - }; - - typedef struct VAAPIEncodeType { -diff --git a/libavcodec/vaapi_encode_av1.c b/libavcodec/vaapi_encode_av1.c -new file mode 100644 -index 0000000..9d101fa ---- /dev/null -+++ b/libavcodec/vaapi_encode_av1.c -@@ -0,0 +1,949 @@ -+/* -+ * Copyright (c) 2023 Intel Corporation -+ * -+ * This file is part of FFmpeg. -+ * -+ * FFmpeg is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License as published by the Free Software Foundation; either -+ * version 2.1 of the License, or (at your option) any later version. -+ * -+ * FFmpeg is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with FFmpeg; if not, write to the Free Software -+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -+ */ -+ -+#include -+#include -+ -+#include "libavutil/pixdesc.h" -+#include "libavutil/opt.h" -+ -+#include "cbs_av1.h" -+#include "put_bits.h" -+#include "codec_internal.h" -+#include "av1_levels.h" -+#include "vaapi_encode.h" -+ -+#define AV1_MAX_QUANT 255 -+ -+typedef struct VAAPIEncodeAV1Picture { -+ int64_t last_idr_frame; -+ int slot; -+} VAAPIEncodeAV1Picture; -+ -+typedef struct VAAPIEncodeAV1Context { -+ VAAPIEncodeContext common; -+ AV1RawOBU sh; /**< sequence header.*/ -+ AV1RawOBU fh; /**< frame header.*/ -+ CodedBitstreamContext *cbc; -+ CodedBitstreamFragment current_obu; -+ VAConfigAttribValEncAV1 attr; -+ VAConfigAttribValEncAV1Ext1 attr_ext1; -+ VAConfigAttribValEncAV1Ext2 attr_ext2; -+ -+ char sh_data[MAX_PARAM_BUFFER_SIZE]; /**< coded sequence header data. */ -+ size_t sh_data_len; /**< bit length of sh_data. */ -+ char fh_data[MAX_PARAM_BUFFER_SIZE]; /**< coded frame header data. */ -+ size_t fh_data_len; /**< bit length of fh_data. */ -+ -+ uint8_t uniform_tile; -+ uint8_t use_128x128_superblock; -+ int sb_cols; -+ int sb_rows; -+ int tile_cols_log2; -+ int tile_rows_log2; -+ int max_tile_width_sb; -+ int max_tile_height_sb; -+ uint8_t width_in_sbs_minus_1[AV1_MAX_TILE_COLS]; -+ uint8_t height_in_sbs_minus_1[AV1_MAX_TILE_ROWS]; -+ -+ int min_log2_tile_cols; -+ int max_log2_tile_cols; -+ int min_log2_tile_rows; -+ int max_log2_tile_rows; -+ -+ int q_idx_idr; -+ int q_idx_p; -+ int q_idx_b; -+ -+ /** bit positions in current frame header */ -+ int qindex_offset; -+ int loopfilter_offset; -+ int cdef_start_offset; -+ int cdef_param_size; -+ -+ /** user options */ -+ int profile; -+ int level; -+ int tier; -+ int tile_cols, tile_rows; -+ int tile_groups; -+} VAAPIEncodeAV1Context; -+ -+static void vaapi_encode_av1_trace_write_log(void *ctx, -+ PutBitContext *pbc, int length, -+ const char *str, const int *subscripts, -+ int64_t value) -+{ -+ VAAPIEncodeAV1Context *priv = ctx; -+ int position; -+ -+ position = put_bits_count(pbc); -+ av_assert0(position >= length); -+ -+ if (!strcmp(str, "base_q_idx")) -+ priv->qindex_offset = position - length; -+ else if (!strcmp(str, "loop_filter_level[0]")) -+ priv->loopfilter_offset = position - length; -+ else if (!strcmp(str, "cdef_damping_minus_3")) -+ priv->cdef_start_offset = position - length; -+ else if (!strcmp(str, "cdef_uv_sec_strength[i]")) -+ priv->cdef_param_size = position - priv->cdef_start_offset; -+} -+ -+static av_cold int vaapi_encode_av1_get_encoder_caps(AVCodecContext *avctx) -+{ -+ VAAPIEncodeContext *ctx = avctx->priv_data; -+ VAAPIEncodeAV1Context *priv = avctx->priv_data; -+ -+ // Surfaces must be aligned to superblock boundaries. -+ ctx->surface_width = FFALIGN(avctx->width, priv->use_128x128_superblock ? 128 : 64); -+ ctx->surface_height = FFALIGN(avctx->height, priv->use_128x128_superblock ? 128 : 64); -+ -+ return 0; -+} -+ -+static av_cold int vaapi_encode_av1_configure(AVCodecContext *avctx) -+{ -+ VAAPIEncodeContext *ctx = avctx->priv_data; -+ VAAPIEncodeAV1Context *priv = avctx->priv_data; -+ int ret; -+ -+ ret = ff_cbs_init(&priv->cbc, AV_CODEC_ID_AV1, avctx); -+ if (ret < 0) -+ return ret; -+ priv->cbc->trace_enable = 1; -+ priv->cbc->trace_level = AV_LOG_DEBUG; -+ priv->cbc->trace_context = ctx; -+ priv->cbc->trace_write_callback = vaapi_encode_av1_trace_write_log; -+ -+ if (ctx->rc_mode->quality) { -+ priv->q_idx_p = av_clip(ctx->rc_quality, 0, AV1_MAX_QUANT); -+ if (fabs(avctx->i_quant_factor) > 0.0) -+ priv->q_idx_idr = -+ av_clip((fabs(avctx->i_quant_factor) * priv->q_idx_p + -+ avctx->i_quant_offset) + 0.5, -+ 0, AV1_MAX_QUANT); -+ else -+ priv->q_idx_idr = priv->q_idx_p; -+ -+ if (fabs(avctx->b_quant_factor) > 0.0) -+ priv->q_idx_b = -+ av_clip((fabs(avctx->b_quant_factor) * priv->q_idx_p + -+ avctx->b_quant_offset) + 0.5, -+ 0, AV1_MAX_QUANT); -+ else -+ priv->q_idx_b = priv->q_idx_p; -+ } else { -+ /** Arbitrary value */ -+ priv->q_idx_idr = priv->q_idx_p = priv->q_idx_b = 128; -+ } -+ -+ return 0; -+} -+ -+static int vaapi_encode_av1_add_obu(AVCodecContext *avctx, -+ CodedBitstreamFragment *au, -+ uint8_t type, -+ void *obu_unit) -+{ -+ int ret; -+ -+ ret = ff_cbs_insert_unit_content(au, -1, -+ type, obu_unit, NULL); -+ if (ret < 0) { -+ av_log(avctx, AV_LOG_ERROR, "Failed to add OBU unit: " -+ "type = %d.\n", type); -+ return ret; -+ } -+ -+ return 0; -+} -+ -+static int vaapi_encode_av1_write_obu(AVCodecContext *avctx, -+ char *data, size_t *data_len, -+ CodedBitstreamFragment *bs) -+{ -+ VAAPIEncodeAV1Context *priv = avctx->priv_data; -+ int ret; -+ -+ ret = ff_cbs_write_fragment_data(priv->cbc, bs); -+ if (ret < 0) { -+ av_log(avctx, AV_LOG_ERROR, "Failed to write packed header.\n"); -+ return ret; -+ } -+ -+ if ((size_t)8 * MAX_PARAM_BUFFER_SIZE < 8 * bs->data_size - bs->data_bit_padding) { -+ av_log(avctx, AV_LOG_ERROR, "Access unit too large: " -+ "%zu < %zu.\n", (size_t)8 * MAX_PARAM_BUFFER_SIZE, -+ 8 * bs->data_size - bs->data_bit_padding); -+ return AVERROR(ENOSPC); -+ } -+ -+ memcpy(data, bs->data, bs->data_size); -+ *data_len = 8 * bs->data_size - bs->data_bit_padding; -+ -+ return 0; -+} -+ -+static int tile_log2(int blkSize, int target) { -+ int k; -+ for (k = 0; (blkSize << k) < target; k++); -+ return k; -+} -+ -+static int vaapi_encode_av1_set_tile(AVCodecContext *avctx) -+{ -+ VAAPIEncodeAV1Context *priv = avctx->priv_data; -+ int mi_cols, mi_rows, sb_shift, sb_size; -+ int max_tile_area_sb, max_tile_area_sb_varied; -+ int tile_width_sb, tile_height_sb, widest_tile_sb; -+ int tile_cols, tile_rows; -+ int min_log2_tiles; -+ int i; -+ -+ if (priv->tile_cols > AV1_MAX_TILE_COLS || -+ priv->tile_rows > AV1_MAX_TILE_ROWS) { -+ av_log(avctx, AV_LOG_ERROR, "Invalid tile number %dx%d, should less than %dx%d.\n", -+ priv->tile_cols, priv->tile_rows, AV1_MAX_TILE_COLS, AV1_MAX_TILE_ROWS); -+ return AVERROR(EINVAL); -+ } -+ -+ mi_cols = 2 * ((avctx->width + 7) >> 3); -+ mi_rows = 2 * ((avctx->height + 7) >> 3); -+ priv->sb_cols = priv->use_128x128_superblock ? -+ ((mi_cols + 31) >> 5) : ((mi_cols + 15) >> 4); -+ priv->sb_rows = priv->use_128x128_superblock ? -+ ((mi_rows + 31) >> 5) : ((mi_rows + 15) >> 4); -+ sb_shift = priv->use_128x128_superblock ? 5 : 4; -+ sb_size = sb_shift + 2; -+ priv->max_tile_width_sb = AV1_MAX_TILE_WIDTH >> sb_size; -+ max_tile_area_sb = AV1_MAX_TILE_AREA >> (2 * sb_size); -+ -+ priv->min_log2_tile_cols = tile_log2(priv->max_tile_width_sb, priv->sb_cols); -+ priv->max_log2_tile_cols = tile_log2(1, FFMIN(priv->sb_cols, AV1_MAX_TILE_COLS)); -+ priv->max_log2_tile_rows = tile_log2(1, FFMIN(priv->sb_rows, AV1_MAX_TILE_ROWS)); -+ min_log2_tiles = FFMAX(priv->min_log2_tile_cols, -+ tile_log2(max_tile_area_sb, priv->sb_rows * priv->sb_cols)); -+ -+ tile_cols = av_clip(priv->tile_cols, (priv->sb_cols + priv->max_tile_width_sb - 1) / priv->max_tile_width_sb, priv->sb_cols); -+ -+ if (!priv->tile_cols) -+ priv->tile_cols = tile_cols; -+ else if (priv->tile_cols != tile_cols){ -+ av_log(avctx, AV_LOG_ERROR, "Invalid tile cols %d, should be in range of %d~%d\n", -+ priv->tile_cols, -+ (priv->sb_cols + priv->max_tile_width_sb - 1) / priv->max_tile_width_sb, -+ priv->sb_cols); -+ return AVERROR(EINVAL); -+ } -+ -+ priv->tile_cols_log2 = tile_log2(1, priv->tile_cols); -+ tile_width_sb = (priv->sb_cols + (1 << priv->tile_cols_log2) - 1) >> -+ priv->tile_cols_log2; -+ -+ if (priv->tile_rows > priv->sb_rows) { -+ av_log(avctx, AV_LOG_ERROR, "Invalid tile rows %d, should be less than %d.\n", -+ priv->tile_rows, priv->sb_rows); -+ return AVERROR(EINVAL); -+ } -+ -+ /** Try user setting tile rows number first. */ -+ tile_rows = priv->tile_rows ? priv->tile_rows : 1; -+ for (; tile_rows <= priv->sb_rows && tile_rows <= AV1_MAX_TILE_ROWS; tile_rows++) { -+ /** try uniformed tile. */ -+ priv->tile_rows_log2 = tile_log2(1, tile_rows); -+ if ((priv->sb_cols + tile_width_sb - 1) / tile_width_sb == priv->tile_cols) { -+ for (i = 0; i < priv->tile_cols - 1; i++) -+ priv->width_in_sbs_minus_1[i] = tile_width_sb - 1; -+ priv->width_in_sbs_minus_1[i] = priv->sb_cols - (priv->tile_cols - 1) * tile_width_sb - 1; -+ -+ tile_height_sb = (priv->sb_rows + (1 << priv->tile_rows_log2) - 1) >> -+ priv->tile_rows_log2; -+ -+ if ((priv->sb_rows + tile_height_sb - 1) / tile_height_sb == tile_rows && -+ tile_height_sb <= max_tile_area_sb / tile_width_sb) { -+ for (i = 0; i < tile_rows - 1; i++) -+ priv->height_in_sbs_minus_1[i] = tile_height_sb - 1; -+ priv->height_in_sbs_minus_1[i] = priv->sb_rows - (tile_rows - 1) * tile_height_sb - 1; -+ -+ priv->uniform_tile = 1; -+ priv->min_log2_tile_rows = FFMAX(min_log2_tiles - priv->tile_cols_log2, 0); -+ -+ break; -+ } -+ } -+ -+ /** try non-uniformed tile. */ -+ widest_tile_sb = 0; -+ for (i = 0; i < priv->tile_cols; i++) { -+ priv->width_in_sbs_minus_1[i] = (i + 1) * priv->sb_cols / priv->tile_cols - i * priv->sb_cols / priv->tile_cols - 1; -+ widest_tile_sb = FFMAX(widest_tile_sb, priv->width_in_sbs_minus_1[i] + 1); -+ } -+ -+ if (min_log2_tiles) -+ max_tile_area_sb_varied = (priv->sb_rows * priv->sb_cols) >> (min_log2_tiles + 1); -+ else -+ max_tile_area_sb_varied = priv->sb_rows * priv->sb_cols; -+ priv->max_tile_height_sb = FFMAX(1, max_tile_area_sb_varied / widest_tile_sb); -+ -+ if (tile_rows == av_clip(tile_rows, (priv->sb_rows + priv->max_tile_height_sb - 1) / priv->max_tile_height_sb, priv->sb_rows)) { -+ for (i = 0; i < tile_rows; i++) -+ priv->height_in_sbs_minus_1[i] = (i + 1) * priv->sb_rows / tile_rows - i * priv->sb_rows / tile_rows - 1; -+ -+ break; -+ } -+ -+ /** Return invalid parameter if explicit tile rows is set. */ -+ if (priv->tile_rows) { -+ av_log(avctx, AV_LOG_ERROR, "Invalid tile rows %d.\n", priv->tile_rows); -+ return AVERROR(EINVAL); -+ } -+ } -+ -+ priv->tile_rows = tile_rows; -+ av_log(avctx, AV_LOG_DEBUG, "Setting tile cols/rows to %d/%d.\n", -+ priv->tile_cols, priv->tile_rows); -+ -+ /** check if tile cols/rows is supported by driver. */ -+ if (priv->attr_ext2.bits.max_tile_num_minus1) { -+ if ((priv->tile_cols * priv->tile_rows - 1) > priv->attr_ext2.bits.max_tile_num_minus1) { -+ av_log(avctx, AV_LOG_ERROR, "Unsupported tile num %d * %d = %d by driver, " -+ "should be at most %d.\n", priv->tile_cols, priv->tile_rows, -+ priv->tile_cols * priv->tile_rows, -+ priv->attr_ext2.bits.max_tile_num_minus1 + 1); -+ return AVERROR(EINVAL); -+ } -+ } -+ -+ /** check if tile group numbers is valid. */ -+ if (priv->tile_groups > priv->tile_cols * priv->tile_rows) { -+ av_log(avctx, AV_LOG_WARNING, "Invalid tile groups number %d, " -+ "correct to %d.\n", priv->tile_groups, priv->tile_cols * priv->tile_rows); -+ priv->tile_groups = priv->tile_cols * priv->tile_rows; -+ } -+ -+ return 0; -+} -+ -+static int vaapi_encode_av1_write_sequence_header(AVCodecContext *avctx, -+ char *data, size_t *data_len) -+{ -+ VAAPIEncodeAV1Context *priv = avctx->priv_data; -+ -+ memcpy(data, &priv->sh_data, MAX_PARAM_BUFFER_SIZE * sizeof(char)); -+ *data_len = priv->sh_data_len; -+ -+ return 0; -+} -+ -+static int vaapi_encode_av1_init_sequence_params(AVCodecContext *avctx) -+{ -+ VAAPIEncodeContext *ctx = avctx->priv_data; -+ VAAPIEncodeAV1Context *priv = avctx->priv_data; -+ AV1RawOBU *sh_obu = &priv->sh; -+ AV1RawSequenceHeader *sh = &sh_obu->obu.sequence_header; -+ VAEncSequenceParameterBufferAV1 *vseq = ctx->codec_sequence_params; -+ CodedBitstreamFragment *obu = &priv->current_obu; -+ const AVPixFmtDescriptor *desc; -+ int ret; -+ -+ memset(sh_obu, 0, sizeof(*sh_obu)); -+ sh_obu->header.obu_type = AV1_OBU_SEQUENCE_HEADER; -+ -+ desc = av_pix_fmt_desc_get(priv->common.input_frames->sw_format); -+ av_assert0(desc); -+ -+ sh->seq_profile = avctx->profile; -+ if (!sh->seq_force_screen_content_tools) -+ sh->seq_force_integer_mv = AV1_SELECT_INTEGER_MV; -+ sh->frame_width_bits_minus_1 = av_log2(avctx->width); -+ sh->frame_height_bits_minus_1 = av_log2(avctx->height); -+ sh->max_frame_width_minus_1 = avctx->width - 1; -+ sh->max_frame_height_minus_1 = avctx->height - 1; -+ sh->seq_tier[0] = priv->tier; -+ /** enable order hint and reserve maximum 8 bits for it by default. */ -+ sh->enable_order_hint = 1; -+ sh->order_hint_bits_minus_1 = 7; -+ -+ sh->color_config = (AV1RawColorConfig) { -+ .high_bitdepth = desc->comp[0].depth == 8 ? 0 : 1, -+ .color_primaries = avctx->color_primaries, -+ .transfer_characteristics = avctx->color_trc, -+ .matrix_coefficients = avctx->colorspace, -+ .color_description_present_flag = (avctx->color_primaries != AVCOL_PRI_UNSPECIFIED || -+ avctx->color_trc != AVCOL_TRC_UNSPECIFIED || -+ avctx->colorspace != AVCOL_SPC_UNSPECIFIED), -+ .color_range = avctx->color_range == AVCOL_RANGE_JPEG, -+ .subsampling_x = desc->log2_chroma_w, -+ .subsampling_y = desc->log2_chroma_h, -+ }; -+ -+ switch (avctx->chroma_sample_location) { -+ case AVCHROMA_LOC_LEFT: -+ sh->color_config.chroma_sample_position = AV1_CSP_VERTICAL; -+ break; -+ case AVCHROMA_LOC_TOPLEFT: -+ sh->color_config.chroma_sample_position = AV1_CSP_COLOCATED; -+ break; -+ default: -+ sh->color_config.chroma_sample_position = AV1_CSP_UNKNOWN; -+ break; -+ } -+ -+ if (avctx->level != FF_PROFILE_UNKNOWN) { -+ sh->seq_level_idx[0] = avctx->level; -+ } else { -+ const AV1LevelDescriptor *level; -+ float framerate; -+ -+ if (avctx->framerate.num > 0 && avctx->framerate.den > 0) -+ framerate = avctx->framerate.num / avctx->framerate.den; -+ else -+ framerate = 0; -+ -+ level = ff_av1_guess_level(avctx->bit_rate, priv->tier, -+ ctx->surface_width, ctx->surface_height, -+ priv->tile_rows * priv->tile_cols, -+ priv->tile_cols, framerate); -+ if (level) { -+ av_log(avctx, AV_LOG_VERBOSE, "Using level %s.\n", level->name); -+ sh->seq_level_idx[0] = level->level_idx; -+ } else { -+ av_log(avctx, AV_LOG_VERBOSE, "Stream will not conform to " -+ "any normal level, using maximum parameters level by default.\n"); -+ sh->seq_level_idx[0] = 31; -+ sh->seq_tier[0] = 1; -+ } -+ } -+ vseq->seq_profile = sh->seq_profile; -+ vseq->seq_level_idx = sh->seq_level_idx[0]; -+ vseq->seq_tier = sh->seq_tier[0]; -+ vseq->order_hint_bits_minus_1 = sh->order_hint_bits_minus_1; -+ vseq->intra_period = ctx->gop_size; -+ vseq->ip_period = ctx->b_per_p + 1; -+ -+ vseq->seq_fields.bits.enable_order_hint = sh->enable_order_hint; -+ -+ if (!(ctx->va_rc_mode & VA_RC_CQP)) { -+ vseq->bits_per_second = ctx->va_bit_rate; -+ vseq->seq_fields.bits.enable_cdef = sh->enable_cdef = 1; -+ } -+ -+ ret = vaapi_encode_av1_add_obu(avctx, obu, AV1_OBU_SEQUENCE_HEADER, &priv->sh); -+ if (ret < 0) -+ goto end; -+ -+ ret = vaapi_encode_av1_write_obu(avctx, priv->sh_data, &priv->sh_data_len, obu); -+ if (ret < 0) -+ goto end; -+ -+end: -+ ff_cbs_fragment_reset(obu); -+ return ret; -+} -+ -+static int vaapi_encode_av1_init_picture_params(AVCodecContext *avctx, -+ VAAPIEncodePicture *pic) -+{ -+ VAAPIEncodeContext *ctx = avctx->priv_data; -+ VAAPIEncodeAV1Context *priv = avctx->priv_data; -+ VAAPIEncodeAV1Picture *hpic = pic->priv_data; -+ AV1RawOBU *fh_obu = &priv->fh; -+ AV1RawFrameHeader *fh = &fh_obu->obu.frame.header; -+ VAEncPictureParameterBufferAV1 *vpic = pic->codec_picture_params; -+ CodedBitstreamFragment *obu = &priv->current_obu; -+ VAAPIEncodePicture *ref; -+ VAAPIEncodeAV1Picture *href; -+ int slot, i; -+ int ret; -+ static const int8_t default_loop_filter_ref_deltas[AV1_TOTAL_REFS_PER_FRAME] = -+ { 1, 0, 0, 0, -1, 0, -1, -1 }; -+ -+ memset(fh_obu, 0, sizeof(*fh_obu)); -+ pic->nb_slices = priv->tile_groups; -+ pic->non_independent_frame = pic->encode_order < pic->display_order; -+ fh_obu->header.obu_type = AV1_OBU_FRAME_HEADER; -+ fh_obu->header.obu_has_size_field = 1; -+ -+ switch (pic->type) { -+ case PICTURE_TYPE_IDR: -+ av_assert0(pic->nb_refs[0] == 0 || pic->nb_refs[1]); -+ fh->frame_type = AV1_FRAME_KEY; -+ fh->refresh_frame_flags = 0xFF; -+ fh->base_q_idx = priv->q_idx_idr; -+ hpic->slot = 0; -+ hpic->last_idr_frame = pic->display_order; -+ break; -+ case PICTURE_TYPE_P: -+ av_assert0(pic->nb_refs[0]); -+ fh->frame_type = AV1_FRAME_INTER; -+ fh->base_q_idx = priv->q_idx_p; -+ ref = pic->refs[0][pic->nb_refs[0] - 1]; -+ href = ref->priv_data; -+ hpic->slot = !href->slot; -+ hpic->last_idr_frame = href->last_idr_frame; -+ fh->refresh_frame_flags = 1 << hpic->slot; -+ -+ /** set the nearest frame in L0 as all reference frame. */ -+ for (i = 0; i < AV1_REFS_PER_FRAME; i++) { -+ fh->ref_frame_idx[i] = href->slot; -+ } -+ fh->primary_ref_frame = href->slot; -+ fh->ref_order_hint[href->slot] = ref->display_order - href->last_idr_frame; -+ vpic->ref_frame_ctrl_l0.fields.search_idx0 = AV1_REF_FRAME_LAST; -+ -+ /** set the 2nd nearest frame in L0 as Golden frame. */ -+ if (pic->nb_refs[0] > 1) { -+ ref = pic->refs[0][pic->nb_refs[0] - 2]; -+ href = ref->priv_data; -+ fh->ref_frame_idx[3] = href->slot; -+ fh->ref_order_hint[href->slot] = ref->display_order - href->last_idr_frame; -+ vpic->ref_frame_ctrl_l0.fields.search_idx1 = AV1_REF_FRAME_GOLDEN; -+ } -+ break; -+ case PICTURE_TYPE_B: -+ av_assert0(pic->nb_refs[0] && pic->nb_refs[1]); -+ fh->frame_type = AV1_FRAME_INTER; -+ fh->base_q_idx = priv->q_idx_b; -+ fh->refresh_frame_flags = 0x0; -+ fh->reference_select = 1; -+ -+ /** B frame will not be referenced, disable its recon frame. */ -+ vpic->picture_flags.bits.disable_frame_recon = 1; -+ -+ /** Use LAST_FRAME and BWDREF_FRAME for reference. */ -+ vpic->ref_frame_ctrl_l0.fields.search_idx0 = AV1_REF_FRAME_LAST; -+ vpic->ref_frame_ctrl_l1.fields.search_idx0 = AV1_REF_FRAME_BWDREF; -+ -+ ref = pic->refs[0][pic->nb_refs[0] - 1]; -+ href = ref->priv_data; -+ hpic->last_idr_frame = href->last_idr_frame; -+ fh->primary_ref_frame = href->slot; -+ fh->ref_order_hint[href->slot] = ref->display_order - href->last_idr_frame; -+ for (i = 0; i < AV1_REF_FRAME_GOLDEN; i++) { -+ fh->ref_frame_idx[i] = href->slot; -+ } -+ -+ ref = pic->refs[1][pic->nb_refs[1] - 1]; -+ href = ref->priv_data; -+ fh->ref_order_hint[href->slot] = ref->display_order - href->last_idr_frame; -+ for (i = AV1_REF_FRAME_GOLDEN; i < AV1_REFS_PER_FRAME; i++) { -+ fh->ref_frame_idx[i] = href->slot; -+ } -+ break; -+ default: -+ av_assert0(0 && "invalid picture type"); -+ } -+ -+ fh->show_frame = pic->display_order <= pic->encode_order; -+ fh->showable_frame = fh->frame_type != AV1_FRAME_KEY; -+ fh->frame_width_minus_1 = avctx->width - 1; -+ fh->frame_height_minus_1 = avctx->height - 1; -+ fh->render_width_minus_1 = fh->frame_width_minus_1; -+ fh->render_height_minus_1 = fh->frame_height_minus_1; -+ fh->order_hint = pic->display_order - hpic->last_idr_frame; -+ fh->tile_cols = priv->tile_cols; -+ fh->tile_rows = priv->tile_rows; -+ fh->tile_cols_log2 = priv->tile_cols_log2; -+ fh->tile_rows_log2 = priv->tile_rows_log2; -+ fh->uniform_tile_spacing_flag = priv->uniform_tile; -+ fh->tile_size_bytes_minus1 = priv->attr_ext2.bits.tile_size_bytes_minus1; -+ -+ /** ignore ONLY_4x4 mode for codedlossless is not fully implemented. */ -+ if (priv->attr_ext2.bits.tx_mode_support & 0x04) -+ fh->tx_mode = AV1_TX_MODE_SELECT; -+ else if (priv->attr_ext2.bits.tx_mode_support & 0x02) -+ fh->tx_mode = AV1_TX_MODE_LARGEST; -+ else { -+ av_log(avctx, AV_LOG_ERROR, "No available tx mode found.\n"); -+ return AVERROR(EINVAL); -+ } -+ -+ for (i = 0; i < fh->tile_cols; i++) -+ fh->width_in_sbs_minus_1[i] = vpic->width_in_sbs_minus_1[i] = priv->width_in_sbs_minus_1[i]; -+ -+ for (i = 0; i < fh->tile_rows; i++) -+ fh->height_in_sbs_minus_1[i] = vpic->height_in_sbs_minus_1[i] = priv->height_in_sbs_minus_1[i]; -+ -+ memcpy(fh->loop_filter_ref_deltas, default_loop_filter_ref_deltas, -+ AV1_TOTAL_REFS_PER_FRAME * sizeof(int8_t)); -+ -+ if (fh->frame_type == AV1_FRAME_KEY && fh->show_frame) { -+ fh->error_resilient_mode = 1; -+ } -+ -+ if (fh->frame_type == AV1_FRAME_KEY || fh->error_resilient_mode) -+ fh->primary_ref_frame = AV1_PRIMARY_REF_NONE; -+ -+ vpic->base_qindex = fh->base_q_idx; -+ vpic->frame_width_minus_1 = fh->frame_width_minus_1; -+ vpic->frame_height_minus_1 = fh->frame_height_minus_1; -+ vpic->primary_ref_frame = fh->primary_ref_frame; -+ vpic->reconstructed_frame = pic->recon_surface; -+ vpic->coded_buf = pic->output_buffer; -+ vpic->tile_cols = fh->tile_cols; -+ vpic->tile_rows = fh->tile_rows; -+ vpic->order_hint = fh->order_hint; -+#if VA_CHECK_VERSION(1, 15, 0) -+ vpic->refresh_frame_flags = fh->refresh_frame_flags; -+#endif -+ -+ vpic->picture_flags.bits.enable_frame_obu = 0; -+ vpic->picture_flags.bits.frame_type = fh->frame_type; -+ vpic->picture_flags.bits.reduced_tx_set = fh->reduced_tx_set; -+ vpic->picture_flags.bits.error_resilient_mode = fh->error_resilient_mode; -+ -+ /** let driver decide to use single or compound reference prediction mode. */ -+ vpic->mode_control_flags.bits.reference_mode = fh->reference_select ? 2 : 0; -+ vpic->mode_control_flags.bits.tx_mode = fh->tx_mode; -+ -+ vpic->tile_group_obu_hdr_info.bits.obu_has_size_field = 1; -+ -+ /** set reference. */ -+ for (i = 0; i < AV1_REFS_PER_FRAME; i++) -+ vpic->ref_frame_idx[i] = fh->ref_frame_idx[i]; -+ -+ for (i = 0; i < FF_ARRAY_ELEMS(vpic->reference_frames); i++) -+ vpic->reference_frames[i] = VA_INVALID_SURFACE; -+ -+ for (i = 0; i < MAX_REFERENCE_LIST_NUM; i++) { -+ for (int j = 0; j < pic->nb_refs[i]; j++) { -+ VAAPIEncodePicture *ref_pic = pic->refs[i][j]; -+ -+ slot = ((VAAPIEncodeAV1Picture*)ref_pic->priv_data)->slot; -+ av_assert0(vpic->reference_frames[slot] == VA_INVALID_SURFACE); -+ -+ vpic->reference_frames[slot] = ref_pic->recon_surface; -+ } -+ } -+ -+ fh_obu->obu_size_byte_len = priv->attr_ext2.bits.obu_size_bytes_minus1 + 1; -+ ret = vaapi_encode_av1_add_obu(avctx, obu, AV1_OBU_FRAME_HEADER, &priv->fh); -+ if (ret < 0) -+ goto end; -+ -+ ret = vaapi_encode_av1_write_obu(avctx, priv->fh_data, &priv->fh_data_len, obu); -+ if (ret < 0) -+ goto end; -+ -+ if (!(ctx->va_rc_mode & VA_RC_CQP)) { -+ vpic->min_base_qindex = av_clip(avctx->qmin, 1, AV1_MAX_QUANT); -+ vpic->max_base_qindex = av_clip(avctx->qmax, 1, AV1_MAX_QUANT); -+ -+ vpic->bit_offset_qindex = priv->qindex_offset; -+ vpic->bit_offset_loopfilter_params = priv->loopfilter_offset; -+ vpic->bit_offset_cdef_params = priv->cdef_start_offset; -+ vpic->size_in_bits_cdef_params = priv->cdef_param_size; -+ vpic->size_in_bits_frame_hdr_obu = priv->fh_data_len; -+ vpic->byte_offset_frame_hdr_obu_size = (((pic->type == PICTURE_TYPE_IDR) ? -+ priv->sh_data_len / 8 : 0) + -+ (fh_obu->header.obu_extension_flag ? -+ 2 : 1)); -+ } -+ -+end: -+ ff_cbs_fragment_reset(obu); -+ return ret; -+} -+ -+static int vaapi_encode_av1_init_slice_params(AVCodecContext *avctx, -+ VAAPIEncodePicture *pic, -+ VAAPIEncodeSlice *slice) -+{ -+ VAAPIEncodeAV1Context *priv = avctx->priv_data; -+ VAEncTileGroupBufferAV1 *vslice = slice->codec_slice_params; -+ CodedBitstreamAV1Context *cbctx = priv->cbc->priv_data; -+ int div; -+ -+ /** Set tile group info. */ -+ div = priv->tile_cols * priv->tile_rows / priv->tile_groups; -+ vslice->tg_start = slice->index * div; -+ if (slice->index == (priv->tile_groups - 1)) { -+ vslice->tg_end = priv->tile_cols * priv->tile_rows - 1; -+ cbctx->seen_frame_header = 0; -+ } else { -+ vslice->tg_end = (slice->index + 1) * div - 1; -+ } -+ -+ return 0; -+} -+ -+static int vaapi_encode_av1_write_picture_header(AVCodecContext *avctx, -+ VAAPIEncodePicture *pic, -+ char *data, size_t *data_len) -+{ -+ VAAPIEncodeAV1Context *priv = avctx->priv_data; -+ CodedBitstreamFragment *obu = &priv->current_obu; -+ CodedBitstreamAV1Context *cbctx = priv->cbc->priv_data; -+ AV1RawOBU *fh_obu = &priv->fh; -+ AV1RawFrameHeader *rep_fh = &fh_obu->obu.frame_header; -+ VAAPIEncodeAV1Picture *href; -+ int ret = 0; -+ -+ pic->tail_size = 0; -+ /** Pack repeat frame header. */ -+ if (pic->display_order > pic->encode_order) { -+ memset(fh_obu, 0, sizeof(*fh_obu)); -+ href = pic->refs[0][pic->nb_refs[0] - 1]->priv_data; -+ fh_obu->header.obu_type = AV1_OBU_FRAME_HEADER; -+ fh_obu->header.obu_has_size_field = 1; -+ -+ rep_fh->show_existing_frame = 1; -+ rep_fh->frame_to_show_map_idx = href->slot == 0; -+ rep_fh->frame_type = AV1_FRAME_INTER; -+ rep_fh->frame_width_minus_1 = avctx->width - 1; -+ rep_fh->frame_height_minus_1 = avctx->height - 1; -+ rep_fh->render_width_minus_1 = rep_fh->frame_width_minus_1; -+ rep_fh->render_height_minus_1 = rep_fh->frame_height_minus_1; -+ -+ cbctx->seen_frame_header = 0; -+ -+ ret = vaapi_encode_av1_add_obu(avctx, obu, AV1_OBU_FRAME_HEADER, &priv->fh); -+ if (ret < 0) -+ goto end; -+ -+ ret = vaapi_encode_av1_write_obu(avctx, pic->tail_data, &pic->tail_size, obu); -+ if (ret < 0) -+ goto end; -+ -+ pic->tail_size /= 8; -+ } -+ -+ memcpy(data, &priv->fh_data, MAX_PARAM_BUFFER_SIZE * sizeof(char)); -+ *data_len = priv->fh_data_len; -+ -+end: -+ ff_cbs_fragment_reset(obu); -+ return ret; -+} -+ -+static const VAAPIEncodeProfile vaapi_encode_av1_profiles[] = { -+ { FF_PROFILE_AV1_MAIN, 8, 3, 1, 1, VAProfileAV1Profile0 }, -+ { FF_PROFILE_AV1_MAIN, 10, 3, 1, 1, VAProfileAV1Profile0 }, -+ { FF_PROFILE_UNKNOWN } -+}; -+ -+static const VAAPIEncodeType vaapi_encode_type_av1 = { -+ .profiles = vaapi_encode_av1_profiles, -+ .flags = FLAG_B_PICTURES | FLAG_TIMESTAMP_NO_DELAY, -+ .default_quality = 25, -+ -+ .get_encoder_caps = &vaapi_encode_av1_get_encoder_caps, -+ .configure = &vaapi_encode_av1_configure, -+ -+ .sequence_header_type = VAEncPackedHeaderSequence, -+ .sequence_params_size = sizeof(VAEncSequenceParameterBufferAV1), -+ .init_sequence_params = &vaapi_encode_av1_init_sequence_params, -+ .write_sequence_header = &vaapi_encode_av1_write_sequence_header, -+ -+ .picture_priv_data_size = sizeof(VAAPIEncodeAV1Picture), -+ .picture_header_type = VAEncPackedHeaderPicture, -+ .picture_params_size = sizeof(VAEncPictureParameterBufferAV1), -+ .init_picture_params = &vaapi_encode_av1_init_picture_params, -+ .write_picture_header = &vaapi_encode_av1_write_picture_header, -+ -+ .slice_params_size = sizeof(VAEncTileGroupBufferAV1), -+ .init_slice_params = &vaapi_encode_av1_init_slice_params, -+}; -+ -+static av_cold int vaapi_encode_av1_init(AVCodecContext *avctx) -+{ -+ VAAPIEncodeContext *ctx = avctx->priv_data; -+ VAAPIEncodeAV1Context *priv = avctx->priv_data; -+ VAConfigAttrib attr; -+ VAStatus vas; -+ int ret; -+ -+ ctx->codec = &vaapi_encode_type_av1; -+ -+ ctx->desired_packed_headers = -+ VA_ENC_PACKED_HEADER_SEQUENCE | -+ VA_ENC_PACKED_HEADER_PICTURE; -+ -+ if (avctx->profile == FF_PROFILE_UNKNOWN) -+ avctx->profile = priv->profile; -+ if (avctx->level == FF_PROFILE_UNKNOWN) -+ avctx->level = priv->level; -+ -+ if (avctx->level != FF_PROFILE_UNKNOWN && avctx->level & ~0x1f) { -+ av_log(avctx, AV_LOG_ERROR, "Invalid level %d\n", avctx->level); -+ return AVERROR(EINVAL); -+ } -+ -+ ret = ff_vaapi_encode_init(avctx); -+ if (ret < 0) -+ return ret; -+ -+ attr.type = VAConfigAttribEncAV1; -+ vas = vaGetConfigAttributes(ctx->hwctx->display, -+ ctx->va_profile, -+ ctx->va_entrypoint, -+ &attr, 1); -+ if (vas != VA_STATUS_SUCCESS) { -+ av_log(avctx, AV_LOG_ERROR, "Failed to query " -+ "config attribute: %d (%s).\n", vas, vaErrorStr(vas)); -+ return AVERROR_EXTERNAL; -+ } else if (attr.value == VA_ATTRIB_NOT_SUPPORTED) { -+ priv->attr.value = 0; -+ av_log(avctx, AV_LOG_WARNING, "Attribute type:%d is not " -+ "supported.\n", attr.type); -+ } else { -+ priv->attr.value = attr.value; -+ } -+ -+ attr.type = VAConfigAttribEncAV1Ext1; -+ vas = vaGetConfigAttributes(ctx->hwctx->display, -+ ctx->va_profile, -+ ctx->va_entrypoint, -+ &attr, 1); -+ if (vas != VA_STATUS_SUCCESS) { -+ av_log(avctx, AV_LOG_ERROR, "Failed to query " -+ "config attribute: %d (%s).\n", vas, vaErrorStr(vas)); -+ return AVERROR_EXTERNAL; -+ } else if (attr.value == VA_ATTRIB_NOT_SUPPORTED) { -+ priv->attr_ext1.value = 0; -+ av_log(avctx, AV_LOG_WARNING, "Attribute type:%d is not " -+ "supported.\n", attr.type); -+ } else { -+ priv->attr_ext1.value = attr.value; -+ } -+ -+ /** This attr provides essential indicators, return error if not support. */ -+ attr.type = VAConfigAttribEncAV1Ext2; -+ vas = vaGetConfigAttributes(ctx->hwctx->display, -+ ctx->va_profile, -+ ctx->va_entrypoint, -+ &attr, 1); -+ if (vas != VA_STATUS_SUCCESS || attr.value == VA_ATTRIB_NOT_SUPPORTED) { -+ av_log(avctx, AV_LOG_ERROR, "Failed to query " -+ "config attribute: %d (%s).\n", vas, vaErrorStr(vas)); -+ return AVERROR_EXTERNAL; -+ } else { -+ priv->attr_ext2.value = attr.value; -+ } -+ -+ ret = vaapi_encode_av1_set_tile(avctx); -+ if (ret < 0) -+ return ret; -+ -+ return 0; -+} -+ -+static av_cold int vaapi_encode_av1_close(AVCodecContext *avctx) -+{ -+ VAAPIEncodeAV1Context *priv = avctx->priv_data; -+ -+ ff_cbs_fragment_free(&priv->current_obu); -+ ff_cbs_close(&priv->cbc); -+ -+ return ff_vaapi_encode_close(avctx); -+} -+ -+#define OFFSET(x) offsetof(VAAPIEncodeAV1Context, x) -+#define FLAGS (AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM) -+ -+static const AVOption vaapi_encode_av1_options[] = { -+ VAAPI_ENCODE_COMMON_OPTIONS, -+ VAAPI_ENCODE_RC_OPTIONS, -+ { "profile", "Set profile (seq_profile)", -+ OFFSET(profile), AV_OPT_TYPE_INT, -+ { .i64 = FF_PROFILE_UNKNOWN }, FF_PROFILE_UNKNOWN, 0xff, FLAGS, "profile" }, -+ -+#define PROFILE(name, value) name, NULL, 0, AV_OPT_TYPE_CONST, \ -+ { .i64 = value }, 0, 0, FLAGS, "profile" -+ { PROFILE("main", FF_PROFILE_AV1_MAIN) }, -+ { PROFILE("high", FF_PROFILE_AV1_HIGH) }, -+ { PROFILE("professional", FF_PROFILE_AV1_PROFESSIONAL) }, -+#undef PROFILE -+ -+ { "tier", "Set tier (seq_tier)", -+ OFFSET(tier), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, FLAGS, "tier" }, -+ { "main", NULL, 0, AV_OPT_TYPE_CONST, -+ { .i64 = 0 }, 0, 0, FLAGS, "tier" }, -+ { "high", NULL, 0, AV_OPT_TYPE_CONST, -+ { .i64 = 1 }, 0, 0, FLAGS, "tier" }, -+ { "level", "Set level (seq_level_idx)", -+ OFFSET(level), AV_OPT_TYPE_INT, -+ { .i64 = FF_PROFILE_UNKNOWN }, FF_PROFILE_UNKNOWN, 0x1f, FLAGS, "level" }, -+ -+#define LEVEL(name, value) name, NULL, 0, AV_OPT_TYPE_CONST, \ -+ { .i64 = value }, 0, 0, FLAGS, "level" -+ { LEVEL("2.0", 0) }, -+ { LEVEL("2.1", 1) }, -+ { LEVEL("3.0", 4) }, -+ { LEVEL("3.1", 5) }, -+ { LEVEL("4.0", 8) }, -+ { LEVEL("4.1", 9) }, -+ { LEVEL("5.0", 12) }, -+ { LEVEL("5.1", 13) }, -+ { LEVEL("5.2", 14) }, -+ { LEVEL("5.3", 15) }, -+ { LEVEL("6.0", 16) }, -+ { LEVEL("6.1", 17) }, -+ { LEVEL("6.2", 18) }, -+ { LEVEL("6.3", 19) }, -+#undef LEVEL -+ -+ { "tiles", "Tile columns x rows (Use minimal tile column/row number automatically by default)", -+ OFFSET(tile_cols), AV_OPT_TYPE_IMAGE_SIZE, { .str = NULL }, 0, 0, FLAGS }, -+ { "tile_groups", "Number of tile groups for encoding", -+ OFFSET(tile_groups), AV_OPT_TYPE_INT, { .i64 = 1 }, 1, AV1_MAX_TILE_ROWS * AV1_MAX_TILE_COLS, FLAGS }, -+ -+ { NULL }, -+}; -+ -+static const FFCodecDefault vaapi_encode_av1_defaults[] = { -+ { "b", "0" }, -+ { "bf", "2" }, -+ { "g", "120" }, -+ { "qmin", "1" }, -+ { "qmax", "255" }, -+ { NULL }, -+}; -+ -+static const AVClass vaapi_encode_av1_class = { -+ .class_name = "av1_vaapi", -+ .item_name = av_default_item_name, -+ .option = vaapi_encode_av1_options, -+ .version = LIBAVUTIL_VERSION_INT, -+}; -+ -+const FFCodec ff_av1_vaapi_encoder = { -+ .p.name = "av1_vaapi", -+ CODEC_LONG_NAME("AV1 (VAAPI)"), -+ .p.type = AVMEDIA_TYPE_VIDEO, -+ .p.id = AV_CODEC_ID_AV1, -+ .priv_data_size = sizeof(VAAPIEncodeAV1Context), -+ .init = &vaapi_encode_av1_init, -+ FF_CODEC_RECEIVE_PACKET_CB(&ff_vaapi_encode_receive_packet), -+ .close = &vaapi_encode_av1_close, -+ .p.priv_class = &vaapi_encode_av1_class, -+ .p.capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_HARDWARE | -+ AV_CODEC_CAP_DR1 | AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE, -+ .caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE | -+ FF_CODEC_CAP_INIT_CLEANUP, -+ .defaults = vaapi_encode_av1_defaults, -+ .p.pix_fmts = (const enum AVPixelFormat[]) { -+ AV_PIX_FMT_VAAPI, -+ AV_PIX_FMT_NONE, -+ }, -+ .hw_configs = ff_vaapi_encode_hw_configs, -+ .p.wrapper_name = "vaapi", -+}; -diff --git a/libavcodec/vaapi_encode_h264.c b/libavcodec/vaapi_encode_h264.c -index 645f6a9..c205d1e 100644 ---- a/libavcodec/vaapi_encode_h264.c -+++ b/libavcodec/vaapi_encode_h264.c -@@ -614,7 +614,7 @@ static int vaapi_encode_h264_init_picture_params(AVCodecContext *avctx, - VAAPIEncodePicture *prev = pic->prev; - VAAPIEncodeH264Picture *hprev = prev ? prev->priv_data : NULL; - VAEncPictureParameterBufferH264 *vpic = pic->codec_picture_params; -- int i; -+ int i, j = 0; - - if (pic->type == PICTURE_TYPE_IDR) { - av_assert0(pic->display_order == pic->encode_order); -@@ -715,24 +715,26 @@ static int vaapi_encode_h264_init_picture_params(AVCodecContext *avctx, - .TopFieldOrderCnt = hpic->pic_order_cnt, - .BottomFieldOrderCnt = hpic->pic_order_cnt, - }; -- -- for (i = 0; i < pic->nb_refs; i++) { -- VAAPIEncodePicture *ref = pic->refs[i]; -- VAAPIEncodeH264Picture *href; -- -- av_assert0(ref && ref->encode_order < pic->encode_order); -- href = ref->priv_data; -- -- vpic->ReferenceFrames[i] = (VAPictureH264) { -- .picture_id = ref->recon_surface, -- .frame_idx = href->frame_num, -- .flags = VA_PICTURE_H264_SHORT_TERM_REFERENCE, -- .TopFieldOrderCnt = href->pic_order_cnt, -- .BottomFieldOrderCnt = href->pic_order_cnt, -- }; -+ for (int k = 0; k < MAX_REFERENCE_LIST_NUM; k++) { -+ for (i = 0; i < pic->nb_refs[k]; i++) { -+ VAAPIEncodePicture *ref = pic->refs[k][i]; -+ VAAPIEncodeH264Picture *href; -+ -+ av_assert0(ref && ref->encode_order < pic->encode_order); -+ href = ref->priv_data; -+ -+ vpic->ReferenceFrames[j++] = (VAPictureH264) { -+ .picture_id = ref->recon_surface, -+ .frame_idx = href->frame_num, -+ .flags = VA_PICTURE_H264_SHORT_TERM_REFERENCE, -+ .TopFieldOrderCnt = href->pic_order_cnt, -+ .BottomFieldOrderCnt = href->pic_order_cnt, -+ }; -+ } - } -- for (; i < FF_ARRAY_ELEMS(vpic->ReferenceFrames); i++) { -- vpic->ReferenceFrames[i] = (VAPictureH264) { -+ -+ for (; j < FF_ARRAY_ELEMS(vpic->ReferenceFrames); j++) { -+ vpic->ReferenceFrames[j] = (VAPictureH264) { - .picture_id = VA_INVALID_ID, - .flags = VA_PICTURE_H264_INVALID, - }; -@@ -934,17 +936,17 @@ static int vaapi_encode_h264_init_slice_params(AVCodecContext *avctx, - - if (pic->type == PICTURE_TYPE_P) { - int need_rplm = 0; -- for (i = 0; i < pic->nb_refs; i++) { -- av_assert0(pic->refs[i]); -- if (pic->refs[i] != def_l0[i]) -+ for (i = 0; i < pic->nb_refs[0]; i++) { -+ av_assert0(pic->refs[0][i]); -+ if (pic->refs[0][i] != def_l0[i]) - need_rplm = 1; - } - - sh->ref_pic_list_modification_flag_l0 = need_rplm; - if (need_rplm) { - int pic_num = hpic->frame_num; -- for (i = 0; i < pic->nb_refs; i++) { -- href = pic->refs[i]->priv_data; -+ for (i = 0; i < pic->nb_refs[0]; i++) { -+ href = pic->refs[0][i]->priv_data; - av_assert0(href->frame_num != pic_num); - if (href->frame_num < pic_num) { - sh->rplm_l0[i].modification_of_pic_nums_idc = 0; -@@ -963,28 +965,29 @@ static int vaapi_encode_h264_init_slice_params(AVCodecContext *avctx, - } else { - int need_rplm_l0 = 0, need_rplm_l1 = 0; - int n0 = 0, n1 = 0; -- for (i = 0; i < pic->nb_refs; i++) { -- av_assert0(pic->refs[i]); -- href = pic->refs[i]->priv_data; -- av_assert0(href->pic_order_cnt != hpic->pic_order_cnt); -- if (href->pic_order_cnt < hpic->pic_order_cnt) { -- if (pic->refs[i] != def_l0[n0]) -- need_rplm_l0 = 1; -- ++n0; -- } else { -- if (pic->refs[i] != def_l1[n1]) -- need_rplm_l1 = 1; -- ++n1; -- } -+ for (i = 0; i < pic->nb_refs[0]; i++) { -+ av_assert0(pic->refs[0][i]); -+ href = pic->refs[0][i]->priv_data; -+ av_assert0(href->pic_order_cnt < hpic->pic_order_cnt); -+ if (pic->refs[0][i] != def_l0[n0]) -+ need_rplm_l0 = 1; -+ ++n0; -+ } -+ -+ for (i = 0; i < pic->nb_refs[1]; i++) { -+ av_assert0(pic->refs[1][i]); -+ href = pic->refs[1][i]->priv_data; -+ av_assert0(href->pic_order_cnt > hpic->pic_order_cnt); -+ if (pic->refs[1][i] != def_l1[n1]) -+ need_rplm_l1 = 1; -+ ++n1; - } - - sh->ref_pic_list_modification_flag_l0 = need_rplm_l0; - if (need_rplm_l0) { - int pic_num = hpic->frame_num; -- for (i = j = 0; i < pic->nb_refs; i++) { -- href = pic->refs[i]->priv_data; -- if (href->pic_order_cnt > hpic->pic_order_cnt) -- continue; -+ for (i = j = 0; i < pic->nb_refs[0]; i++) { -+ href = pic->refs[0][i]->priv_data; - av_assert0(href->frame_num != pic_num); - if (href->frame_num < pic_num) { - sh->rplm_l0[j].modification_of_pic_nums_idc = 0; -@@ -1005,10 +1008,8 @@ static int vaapi_encode_h264_init_slice_params(AVCodecContext *avctx, - sh->ref_pic_list_modification_flag_l1 = need_rplm_l1; - if (need_rplm_l1) { - int pic_num = hpic->frame_num; -- for (i = j = 0; i < pic->nb_refs; i++) { -- href = pic->refs[i]->priv_data; -- if (href->pic_order_cnt < hpic->pic_order_cnt) -- continue; -+ for (i = j = 0; i < pic->nb_refs[1]; i++) { -+ href = pic->refs[1][i]->priv_data; - av_assert0(href->frame_num != pic_num); - if (href->frame_num < pic_num) { - sh->rplm_l1[j].modification_of_pic_nums_idc = 0; -@@ -1048,14 +1049,13 @@ static int vaapi_encode_h264_init_slice_params(AVCodecContext *avctx, - vslice->RefPicList1[i].flags = VA_PICTURE_H264_INVALID; - } - -- av_assert0(pic->nb_refs <= 2); -- if (pic->nb_refs >= 1) { -+ if (pic->nb_refs[0]) { - // Backward reference for P- or B-frame. - av_assert0(pic->type == PICTURE_TYPE_P || - pic->type == PICTURE_TYPE_B); - vslice->RefPicList0[0] = vpic->ReferenceFrames[0]; - } -- if (pic->nb_refs >= 2) { -+ if (pic->nb_refs[1]) { - // Forward reference for B-frame. - av_assert0(pic->type == PICTURE_TYPE_B); - vslice->RefPicList1[0] = vpic->ReferenceFrames[1]; -diff --git a/libavcodec/vaapi_encode_h265.c b/libavcodec/vaapi_encode_h265.c -index aa7e532..f015e6f 100644 ---- a/libavcodec/vaapi_encode_h265.c -+++ b/libavcodec/vaapi_encode_h265.c -@@ -764,7 +764,7 @@ static int vaapi_encode_h265_init_picture_params(AVCodecContext *avctx, - VAAPIEncodePicture *prev = pic->prev; - VAAPIEncodeH265Picture *hprev = prev ? prev->priv_data : NULL; - VAEncPictureParameterBufferHEVC *vpic = pic->codec_picture_params; -- int i; -+ int i, j = 0; - - if (pic->type == PICTURE_TYPE_IDR) { - av_assert0(pic->display_order == pic->encode_order); -@@ -789,8 +789,8 @@ static int vaapi_encode_h265_init_picture_params(AVCodecContext *avctx, - hpic->pic_type = 1; - } else { - VAAPIEncodePicture *irap_ref; -- av_assert0(pic->refs[0] && pic->refs[1]); -- for (irap_ref = pic; irap_ref; irap_ref = irap_ref->refs[1]) { -+ av_assert0(pic->refs[0][0] && pic->refs[1][0]); -+ for (irap_ref = pic; irap_ref; irap_ref = irap_ref->refs[1][0]) { - if (irap_ref->type == PICTURE_TYPE_I) - break; - } -@@ -915,24 +915,27 @@ static int vaapi_encode_h265_init_picture_params(AVCodecContext *avctx, - .flags = 0, - }; - -- for (i = 0; i < pic->nb_refs; i++) { -- VAAPIEncodePicture *ref = pic->refs[i]; -- VAAPIEncodeH265Picture *href; -- -- av_assert0(ref && ref->encode_order < pic->encode_order); -- href = ref->priv_data; -- -- vpic->reference_frames[i] = (VAPictureHEVC) { -- .picture_id = ref->recon_surface, -- .pic_order_cnt = href->pic_order_cnt, -- .flags = (ref->display_order < pic->display_order ? -- VA_PICTURE_HEVC_RPS_ST_CURR_BEFORE : 0) | -- (ref->display_order > pic->display_order ? -- VA_PICTURE_HEVC_RPS_ST_CURR_AFTER : 0), -- }; -+ for (int k = 0; k < MAX_REFERENCE_LIST_NUM; k++) { -+ for (i = 0; i < pic->nb_refs[k]; i++) { -+ VAAPIEncodePicture *ref = pic->refs[k][i]; -+ VAAPIEncodeH265Picture *href; -+ -+ av_assert0(ref && ref->encode_order < pic->encode_order); -+ href = ref->priv_data; -+ -+ vpic->reference_frames[j++] = (VAPictureHEVC) { -+ .picture_id = ref->recon_surface, -+ .pic_order_cnt = href->pic_order_cnt, -+ .flags = (ref->display_order < pic->display_order ? -+ VA_PICTURE_HEVC_RPS_ST_CURR_BEFORE : 0) | -+ (ref->display_order > pic->display_order ? -+ VA_PICTURE_HEVC_RPS_ST_CURR_AFTER : 0), -+ }; -+ } - } -- for (; i < FF_ARRAY_ELEMS(vpic->reference_frames); i++) { -- vpic->reference_frames[i] = (VAPictureHEVC) { -+ -+ for (; j < FF_ARRAY_ELEMS(vpic->reference_frames); j++) { -+ vpic->reference_frames[j] = (VAPictureHEVC) { - .picture_id = VA_INVALID_ID, - .flags = VA_PICTURE_HEVC_INVALID, - }; -@@ -1016,21 +1019,33 @@ static int vaapi_encode_h265_init_slice_params(AVCodecContext *avctx, - memset(rps, 0, sizeof(*rps)); - - rps_pics = 0; -- for (i = 0; i < pic->nb_refs; i++) { -- strp = pic->refs[i]->priv_data; -- rps_poc[rps_pics] = strp->pic_order_cnt; -- rps_used[rps_pics] = 1; -- ++rps_pics; -+ for (i = 0; i < MAX_REFERENCE_LIST_NUM; i++) { -+ for (j = 0; j < pic->nb_refs[i]; j++) { -+ strp = pic->refs[i][j]->priv_data; -+ rps_poc[rps_pics] = strp->pic_order_cnt; -+ rps_used[rps_pics] = 1; -+ ++rps_pics; -+ } - } -+ - for (i = 0; i < pic->nb_dpb_pics; i++) { - if (pic->dpb[i] == pic) - continue; -- for (j = 0; j < pic->nb_refs; j++) { -- if (pic->dpb[i] == pic->refs[j]) -+ -+ for (j = 0; j < pic->nb_refs[0]; j++) { -+ if (pic->dpb[i] == pic->refs[0][j]) -+ break; -+ } -+ if (j < pic->nb_refs[0]) -+ continue; -+ -+ for (j = 0; j < pic->nb_refs[1]; j++) { -+ if (pic->dpb[i] == pic->refs[1][j]) - break; - } -- if (j < pic->nb_refs) -+ if (j < pic->nb_refs[1]) - continue; -+ - strp = pic->dpb[i]->priv_data; - rps_poc[rps_pics] = strp->pic_order_cnt; - rps_used[rps_pics] = 0; -@@ -1155,8 +1170,7 @@ static int vaapi_encode_h265_init_slice_params(AVCodecContext *avctx, - vslice->ref_pic_list1[i].flags = VA_PICTURE_HEVC_INVALID; - } - -- av_assert0(pic->nb_refs <= 2); -- if (pic->nb_refs >= 1) { -+ if (pic->nb_refs[0]) { - // Backward reference for P- or B-frame. - av_assert0(pic->type == PICTURE_TYPE_P || - pic->type == PICTURE_TYPE_B); -@@ -1165,7 +1179,7 @@ static int vaapi_encode_h265_init_slice_params(AVCodecContext *avctx, - // Reference for GPB B-frame, L0 == L1 - vslice->ref_pic_list1[0] = vpic->reference_frames[0]; - } -- if (pic->nb_refs >= 2) { -+ if (pic->nb_refs[1]) { - // Forward reference for B-frame. - av_assert0(pic->type == PICTURE_TYPE_B); - vslice->ref_pic_list1[0] = vpic->reference_frames[1]; -diff --git a/libavcodec/vaapi_encode_mpeg2.c b/libavcodec/vaapi_encode_mpeg2.c -index 9261d19..8000ae1 100644 ---- a/libavcodec/vaapi_encode_mpeg2.c -+++ b/libavcodec/vaapi_encode_mpeg2.c -@@ -458,12 +458,12 @@ static int vaapi_encode_mpeg2_init_picture_params(AVCodecContext *avctx, - break; - case PICTURE_TYPE_P: - vpic->picture_type = VAEncPictureTypePredictive; -- vpic->forward_reference_picture = pic->refs[0]->recon_surface; -+ vpic->forward_reference_picture = pic->refs[0][0]->recon_surface; - break; - case PICTURE_TYPE_B: - vpic->picture_type = VAEncPictureTypeBidirectional; -- vpic->forward_reference_picture = pic->refs[0]->recon_surface; -- vpic->backward_reference_picture = pic->refs[1]->recon_surface; -+ vpic->forward_reference_picture = pic->refs[0][0]->recon_surface; -+ vpic->backward_reference_picture = pic->refs[1][0]->recon_surface; - break; - default: - av_assert0(0 && "invalid picture type"); -diff --git a/libavcodec/vaapi_encode_vp8.c b/libavcodec/vaapi_encode_vp8.c -index ae6a8d3..b96e4cd 100644 ---- a/libavcodec/vaapi_encode_vp8.c -+++ b/libavcodec/vaapi_encode_vp8.c -@@ -86,7 +86,7 @@ static int vaapi_encode_vp8_init_picture_params(AVCodecContext *avctx, - switch (pic->type) { - case PICTURE_TYPE_IDR: - case PICTURE_TYPE_I: -- av_assert0(pic->nb_refs == 0); -+ av_assert0(pic->nb_refs[0] == 0 && pic->nb_refs[1] == 0); - vpic->ref_flags.bits.force_kf = 1; - vpic->ref_last_frame = - vpic->ref_gf_frame = -@@ -94,14 +94,14 @@ static int vaapi_encode_vp8_init_picture_params(AVCodecContext *avctx, - VA_INVALID_SURFACE; - break; - case PICTURE_TYPE_P: -- av_assert0(pic->nb_refs == 1); -+ av_assert0(!pic->nb_refs[1]); - vpic->ref_flags.bits.no_ref_last = 0; - vpic->ref_flags.bits.no_ref_gf = 1; - vpic->ref_flags.bits.no_ref_arf = 1; - vpic->ref_last_frame = - vpic->ref_gf_frame = - vpic->ref_arf_frame = -- pic->refs[0]->recon_surface; -+ pic->refs[0][0]->recon_surface; - break; - default: - av_assert0(0 && "invalid picture type"); -diff --git a/libavcodec/vaapi_encode_vp9.c b/libavcodec/vaapi_encode_vp9.c -index af1353c..d9e8ba6 100644 ---- a/libavcodec/vaapi_encode_vp9.c -+++ b/libavcodec/vaapi_encode_vp9.c -@@ -96,15 +96,15 @@ static int vaapi_encode_vp9_init_picture_params(AVCodecContext *avctx, - - switch (pic->type) { - case PICTURE_TYPE_IDR: -- av_assert0(pic->nb_refs == 0); -+ av_assert0(pic->nb_refs[0] == 0 && pic->nb_refs[1] == 0); - vpic->ref_flags.bits.force_kf = 1; - vpic->refresh_frame_flags = 0xff; - hpic->slot = 0; - break; - case PICTURE_TYPE_P: -- av_assert0(pic->nb_refs == 1); -+ av_assert0(!pic->nb_refs[1]); - { -- VAAPIEncodeVP9Picture *href = pic->refs[0]->priv_data; -+ VAAPIEncodeVP9Picture *href = pic->refs[0][0]->priv_data; - av_assert0(href->slot == 0 || href->slot == 1); - - if (ctx->max_b_depth > 0) { -@@ -120,10 +120,10 @@ static int vaapi_encode_vp9_init_picture_params(AVCodecContext *avctx, - } - break; - case PICTURE_TYPE_B: -- av_assert0(pic->nb_refs == 2); -+ av_assert0(pic->nb_refs[0] && pic->nb_refs[1]); - { -- VAAPIEncodeVP9Picture *href0 = pic->refs[0]->priv_data, -- *href1 = pic->refs[1]->priv_data; -+ VAAPIEncodeVP9Picture *href0 = pic->refs[0][0]->priv_data, -+ *href1 = pic->refs[1][0]->priv_data; - av_assert0(href0->slot < pic->b_depth + 1 && - href1->slot < pic->b_depth + 1); - -@@ -157,12 +157,14 @@ static int vaapi_encode_vp9_init_picture_params(AVCodecContext *avctx, - for (i = 0; i < FF_ARRAY_ELEMS(vpic->reference_frames); i++) - vpic->reference_frames[i] = VA_INVALID_SURFACE; - -- for (i = 0; i < pic->nb_refs; i++) { -- VAAPIEncodePicture *ref_pic = pic->refs[i]; -- int slot; -- slot = ((VAAPIEncodeVP9Picture*)ref_pic->priv_data)->slot; -- av_assert0(vpic->reference_frames[slot] == VA_INVALID_SURFACE); -- vpic->reference_frames[slot] = ref_pic->recon_surface; -+ for (i = 0; i < MAX_REFERENCE_LIST_NUM; i++) { -+ for (int j = 0; j < pic->nb_refs[i]; j++) { -+ VAAPIEncodePicture *ref_pic = pic->refs[i][j]; -+ int slot; -+ slot = ((VAAPIEncodeVP9Picture*)ref_pic->priv_data)->slot; -+ av_assert0(vpic->reference_frames[slot] == VA_INVALID_SURFACE); -+ vpic->reference_frames[slot] = ref_pic->recon_surface; -+ } - } - - vpic->pic_flags.bits.frame_type = (pic->type != PICTURE_TYPE_IDR); --- -2.41.0 - diff --git a/ffmpeg-new-coder-errors.patch b/ffmpeg-new-coder-errors.patch deleted file mode 100644 index a08b6a9..0000000 --- a/ffmpeg-new-coder-errors.patch +++ /dev/null @@ -1,37 +0,0 @@ -From: Jan Engelhardt -Date: 2016-04-10 23:23:53.138440254 +0200 - -Improve the error messages a bit to say what's really going on -(in light of a reduced build). - ---- - fftools/ffmpeg.c | 2 +- - fftools/ffmpeg_filter.c | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -Index: ffmpeg-6.0/fftools/ffmpeg.c -=================================================================== ---- ffmpeg-6.0.orig/fftools/ffmpeg.c -+++ ffmpeg-6.0/fftools/ffmpeg.c -@@ -2797,7 +2797,7 @@ static int init_input_stream(InputStream - if (ist->decoding_needed) { - const AVCodec *codec = ist->dec; - if (!codec) { -- snprintf(error, error_len, "Decoder (codec %s) not found for input stream #%d:%d", -+ snprintf(error, error_len, "This build of ffmpeg does not include a \"%s\" decoder needed for input stream #%d:%d.", - avcodec_get_name(ist->dec_ctx->codec_id), ist->file_index, ist->st->index); - return AVERROR(EINVAL); - } -Index: ffmpeg-6.0/fftools/ffmpeg_filter.c -=================================================================== ---- ffmpeg-6.0.orig/fftools/ffmpeg_filter.c -+++ ffmpeg-6.0/fftools/ffmpeg_filter.c -@@ -1064,7 +1064,7 @@ static int configure_input_filter(Filter - { - if (!ifilter->ist->dec) { - av_log(NULL, AV_LOG_ERROR, -- "No decoder for stream #%d:%d, filtering impossible\n", -+ "This build of ffmpeg does not have a suitable decoder for stream #%d:%d enabled, filtering impossible\n", - ifilter->ist->file_index, ifilter->ist->st->index); - return AVERROR_DECODER_NOT_FOUND; - } diff --git a/ffmpeg.spec b/ffmpeg.spec index 0ba795e..f2e147b 100644 --- a/ffmpeg.spec +++ b/ffmpeg.spec @@ -91,8 +91,8 @@ Name: ffmpeg %global pkg_name %{name}%{?pkg_suffix} -Version: 6.0.1 -Release: 2%{?dist} +Version: 6.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/ @@ -113,32 +113,15 @@ Source93: ffmpeg_find_free_source_headers.sh # Fixes for reduced codec selection on free build Patch1: ffmpeg-codec-choice.patch -# Better error messages for free build -Patch2: ffmpeg-new-coder-errors.patch # Allow to build with fdk-aac-free # See https://bugzilla.redhat.com/show_bug.cgi?id=1501522#c112 -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 -Patch7: 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 - +Patch2: ffmpeg-allow-fdk-aac-free.patch +# Backport fix for Vulkan Video with only AV1 +# From: https://ffmpeg.org/pipermail/ffmpeg-devel/2023-December/317728.html +Patch3: 0001-lavc-Makefile-build-vulkan-decode-code-if-vulkan_av1.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 +Patch4: 0001-lavc-libopenh264-Drop-openh264-runtime-version-check.patch # Set up dlopen for openh264 Patch1001: ffmpeg-dlopen-openh264.patch @@ -256,7 +239,7 @@ BuildRequires: pkgconfig(vidstab) BuildRequires: pkgconfig(vorbis) BuildRequires: pkgconfig(vo-amrwbenc) BuildRequires: pkgconfig(vpx) -BuildRequires: pkgconfig(vulkan) +BuildRequires: pkgconfig(vulkan) >= 1.3.255 BuildRequires: pkgconfig(wavpack) BuildRequires: pkgconfig(xcb) BuildRequires: pkgconfig(xcb-render) @@ -880,6 +863,9 @@ rm -rf %{buildroot}%{_datadir}/%{name}/examples %{_mandir}/man3/libswscale.3* %changelog +* Thu Jan 04 2024 Neal Gompa - 6.1-1 +- Rebase to 6.1 + * Wed Dec 06 2023 Kalev Lember - 6.0.1-2 - Prefer openh264 over noopenh264 - Backport upstream patch to drop openh264 runtime version checks diff --git a/ffmpeg_free_sources b/ffmpeg_free_sources index 0354de5..9830b45 100644 --- a/ffmpeg_free_sources +++ b/ffmpeg_free_sources @@ -29,8 +29,6 @@ doc/codecs.texi doc/decoders.texi doc/default.css doc/demuxers.texi -doc/dev_community/community.md -doc/dev_community/resolution_process.md doc/developer.texi doc/devices.texi doc/doxy-wrapper.sh @@ -138,7 +136,9 @@ fftools/cmdutils.c fftools/cmdutils.h fftools/ffmpeg.c fftools/ffmpeg.h +fftools/ffmpeg_dec.c fftools/ffmpeg_demux.c +fftools/ffmpeg_enc.c fftools/ffmpeg_filter.c fftools/ffmpeg_hw.c fftools/ffmpeg_mux.c @@ -212,10 +212,7 @@ libavcodec/aandcttab.h libavcodec/aarch64/Makefile libavcodec/aarch64/aacpsdsp_init_aarch64.c libavcodec/aarch64/aacpsdsp_neon.S -libavcodec/aarch64/asm-offsets.h libavcodec/aarch64/cabac.h -libavcodec/aarch64/fft_init_aarch64.c -libavcodec/aarch64/fft_neon.S libavcodec/aarch64/fmtconvert_init.c libavcodec/aarch64/fmtconvert_neon.S libavcodec/aarch64/h264chroma_init_aarch64.c @@ -232,7 +229,6 @@ libavcodec/aarch64/hpeldsp_neon.S libavcodec/aarch64/idct.h libavcodec/aarch64/idctdsp_init_aarch64.c libavcodec/aarch64/idctdsp_neon.S -libavcodec/aarch64/mdct_neon.S libavcodec/aarch64/me_cmp_init_aarch64.c libavcodec/aarch64/me_cmp_neon.S libavcodec/aarch64/mpegaudiodsp_init.c @@ -358,9 +354,6 @@ libavcodec/arm/blockdsp_init_neon.c libavcodec/arm/blockdsp_neon.S libavcodec/arm/cabac.h libavcodec/arm/dca.h -libavcodec/arm/fft_init_arm.c -libavcodec/arm/fft_neon.S -libavcodec/arm/fft_vfp.S libavcodec/arm/flacdsp_arm.S libavcodec/arm/flacdsp_init_arm.c libavcodec/arm/fmtconvert_init_arm.c @@ -398,8 +391,6 @@ libavcodec/arm/jrevdct_arm.S libavcodec/arm/lossless_audiodsp_init_arm.c libavcodec/arm/lossless_audiodsp_neon.S libavcodec/arm/mathops.h -libavcodec/arm/mdct_neon.S -libavcodec/arm/mdct_vfp.S libavcodec/arm/me_cmp_armv6.S libavcodec/arm/me_cmp_init_arm.c libavcodec/arm/mlpdsp_armv5te.S @@ -419,8 +410,6 @@ libavcodec/arm/neontest.c libavcodec/arm/pixblockdsp_armv6.S libavcodec/arm/pixblockdsp_init_arm.c libavcodec/arm/pixblockdsp_neon.S -libavcodec/arm/rdft_init_arm.c -libavcodec/arm/rdft_neon.S libavcodec/arm/sbcdsp_armv6.S libavcodec/arm/sbcdsp_init_arm.c libavcodec/arm/sbcdsp_neon.S @@ -468,6 +457,7 @@ libavcodec/arm/vp9lpf_16bpp_neon.S libavcodec/arm/vp9lpf_neon.S libavcodec/arm/vp9mc_16bpp_neon.S libavcodec/arm/vp9mc_neon.S +libavcodec/arm/vpx_arith.h libavcodec/ass.c libavcodec/ass.h libavcodec/ass_split.c @@ -499,6 +489,8 @@ libavcodec/aura.c libavcodec/av1.h libavcodec/av1_frame_merge_bsf.c libavcodec/av1_frame_split_bsf.c +libavcodec/av1_levels.c +libavcodec/av1_levels.h libavcodec/av1_metadata_bsf.c libavcodec/av1_parse.c libavcodec/av1_parse.h @@ -507,6 +499,7 @@ libavcodec/av1dec.c libavcodec/av1dec.h libavcodec/avcodec.c libavcodec/avcodec.h +libavcodec/avcodec_internal.h libavcodec/avdct.c libavcodec/avdct.h libavcodec/avfft.c @@ -573,6 +566,8 @@ libavcodec/cbs_h2645.h libavcodec/cbs_h264_syntax_template.c libavcodec/cbs_h265.h libavcodec/cbs_h265_syntax_template.c +libavcodec/cbs_h266.h +libavcodec/cbs_h266_syntax_template.c libavcodec/cbs_internal.h libavcodec/cbs_jpeg.c libavcodec/cbs_jpeg.h @@ -652,7 +647,6 @@ libavcodec/dcaenc.h libavcodec/dcahuff.c libavcodec/dcahuff.h libavcodec/dcamath.h -libavcodec/dct.c libavcodec/dct.h libavcodec/dct32.h libavcodec/dct32_fixed.c @@ -731,8 +725,6 @@ libavcodec/dvenc.c libavcodec/dxa.c libavcodec/dxtory.c libavcodec/dxva2.h -libavcodec/dynamic_hdr10_plus.c -libavcodec/dynamic_hdr10_plus.h libavcodec/dynamic_hdr_vivid.c libavcodec/dynamic_hdr_vivid.h libavcodec/eac3_core_bsf.c @@ -754,6 +746,13 @@ libavcodec/error_resilience.c libavcodec/error_resilience.h libavcodec/escape124.c libavcodec/escape130.c +libavcodec/evc.h +libavcodec/evc_frame_merge_bsf.c +libavcodec/evc_parse.c +libavcodec/evc_parse.h +libavcodec/evc_parser.c +libavcodec/evc_ps.c +libavcodec/evc_ps.h libavcodec/evrcdata.h libavcodec/evrcdec.c libavcodec/exif.c @@ -773,13 +772,6 @@ libavcodec/fdctdsp.c libavcodec/fdctdsp.h libavcodec/fflcms2.c libavcodec/fflcms2.h -libavcodec/fft-internal.h -libavcodec/fft.h -libavcodec/fft_fixed_32.c -libavcodec/fft_float.c -libavcodec/fft_init_table.c -libavcodec/fft_table.h -libavcodec/fft_template.c libavcodec/ffv1.c libavcodec/ffv1.h libavcodec/ffv1_template.c @@ -916,6 +908,7 @@ libavcodec/h264qpel_template.c libavcodec/h265_metadata_bsf.c libavcodec/h265_profile_level.c libavcodec/h265_profile_level.h +libavcodec/h266_metadata_bsf.c libavcodec/h274.h libavcodec/half2float.c libavcodec/hap.c @@ -970,6 +963,7 @@ libavcodec/huffyuvdsp.h libavcodec/huffyuvenc.c libavcodec/huffyuvencdsp.c libavcodec/huffyuvencdsp.h +libavcodec/hwaccel_internal.h libavcodec/hwaccels.h libavcodec/hwconfig.h libavcodec/idcinvideo.c @@ -1021,10 +1015,13 @@ libavcodec/jpeg2000.c libavcodec/jpeg2000.h libavcodec/jpeg2000_parser.c libavcodec/jpeg2000dec.c +libavcodec/jpeg2000dec.h libavcodec/jpeg2000dsp.c libavcodec/jpeg2000dsp.h libavcodec/jpeg2000dwt.c libavcodec/jpeg2000dwt.h +libavcodec/jpeg2000htdec.c +libavcodec/jpeg2000htdec.h libavcodec/jpegls.c libavcodec/jpegls.h libavcodec/jpeglsdec.c @@ -1035,6 +1032,10 @@ libavcodec/jpegquanttables.h libavcodec/jpegtables.c libavcodec/jpegtables.h libavcodec/jpegtabs.h +libavcodec/jpegxl.h +libavcodec/jpegxl_parse.c +libavcodec/jpegxl_parse.h +libavcodec/jpegxl_parser.c libavcodec/jrevdct.c libavcodec/jvdec.c libavcodec/kbdwin.c @@ -1070,7 +1071,6 @@ libavcodec/libopenh264.c libavcodec/libopenh264.h libavcodec/libopenh264dec.c libavcodec/libopenh264enc.c -libavcodec/libopenjpegdec.c libavcodec/libopenjpegenc.c libavcodec/libopus.c libavcodec/libopus.h @@ -1086,7 +1086,6 @@ libavcodec/libtwolame.c libavcodec/libvo-amrwbenc.c libavcodec/libvorbisdec.c libavcodec/libvorbisenc.c -libavcodec/libvpx.c libavcodec/libvpx.h libavcodec/libvpxdec.c libavcodec/libvpxenc.c @@ -1117,9 +1116,6 @@ libavcodec/m101.c libavcodec/mace.c libavcodec/mathops.h libavcodec/mathtables.c -libavcodec/mdct_fixed_32.c -libavcodec/mdct_float.c -libavcodec/mdct_template.c libavcodec/mdec.c libavcodec/me_cmp.c libavcodec/me_cmp.h @@ -1381,10 +1377,6 @@ libavcodec/ppc/audiodsp.c libavcodec/ppc/blockdsp.c libavcodec/ppc/fdct.h libavcodec/ppc/fdctdsp.c -libavcodec/ppc/fft_altivec.S -libavcodec/ppc/fft_init.c -libavcodec/ppc/fft_vsx.c -libavcodec/ppc/fft_vsx.h libavcodec/ppc/fmtconvert_altivec.c libavcodec/ppc/h264chroma_init.c libavcodec/ppc/h264chroma_template.c @@ -1470,15 +1462,17 @@ libavcodec/raw.c libavcodec/raw.h libavcodec/rawdec.c libavcodec/rawenc.c -libavcodec/rdft.c -libavcodec/rdft.h libavcodec/realtextdec.c libavcodec/rectangle.h +libavcodec/refstruct.c +libavcodec/refstruct.h libavcodec/remove_extradata_bsf.c libavcodec/reverse.c libavcodec/riscv/Makefile libavcodec/riscv/aacpsdsp_init.c libavcodec/riscv/aacpsdsp_rvv.S +libavcodec/riscv/ac3dsp_init.c +libavcodec/riscv/ac3dsp_rvb.S libavcodec/riscv/alacdsp_init.c libavcodec/riscv/alacdsp_rvv.S libavcodec/riscv/audiodsp_init.c @@ -1487,8 +1481,14 @@ libavcodec/riscv/audiodsp_rvv.S libavcodec/riscv/bswapdsp_init.c libavcodec/riscv/bswapdsp_rvb.S libavcodec/riscv/bswapdsp_rvv.S +libavcodec/riscv/exrdsp_init.c +libavcodec/riscv/exrdsp_rvv.S libavcodec/riscv/fmtconvert_init.c libavcodec/riscv/fmtconvert_rvv.S +libavcodec/riscv/g722dsp_init.c +libavcodec/riscv/g722dsp_rvv.S +libavcodec/riscv/h264_chroma_init_riscv.c +libavcodec/riscv/h264_mc_chroma.S libavcodec/riscv/idctdsp_init.c libavcodec/riscv/idctdsp_rvv.S libavcodec/riscv/opusdsp_init.c @@ -1696,6 +1696,7 @@ libavcodec/vaapi_decode.c libavcodec/vaapi_decode.h libavcodec/vaapi_encode.c libavcodec/vaapi_encode.h +libavcodec/vaapi_encode_av1.c libavcodec/vaapi_encode_h264.c libavcodec/vaapi_encode_h265.c libavcodec/vaapi_encode_mjpeg.c @@ -1778,6 +1779,7 @@ libavcodec/vp8.c libavcodec/vp8.h libavcodec/vp89_rac.h libavcodec/vp8_parser.c +libavcodec/vp8data.c libavcodec/vp8data.h libavcodec/vp8dsp.c libavcodec/vp8dsp.h @@ -1808,6 +1810,18 @@ libavcodec/vpx_rac.c libavcodec/vpx_rac.h libavcodec/vqavideo.c libavcodec/vqcdec.c +libavcodec/vulkan.c +libavcodec/vulkan.h +libavcodec/vulkan_av1.c +libavcodec/vulkan_decode.c +libavcodec/vulkan_decode.h +libavcodec/vulkan_video.c +libavcodec/vulkan_video.h +libavcodec/vulkan_video_codec_av1std.h +libavcodec/vulkan_video_codec_av1std_decode.h +libavcodec/vvc.h +libavcodec/vvc_mp4toannexb_bsf.c +libavcodec/vvc_parser.c libavcodec/wavarc.c libavcodec/wavpack.c libavcodec/wavpack.h @@ -1875,7 +1889,6 @@ libavcodec/x86/constants.h libavcodec/x86/dcadsp.asm libavcodec/x86/dcadsp_init.c libavcodec/x86/dct32.asm -libavcodec/x86/dct_init.c libavcodec/x86/dirac_dwt.asm libavcodec/x86/dirac_dwt_init.c libavcodec/x86/diracdsp.asm @@ -1887,9 +1900,6 @@ libavcodec/x86/exrdsp_init.c libavcodec/x86/fdct.c libavcodec/x86/fdct.h libavcodec/x86/fdctdsp_init.c -libavcodec/x86/fft.asm -libavcodec/x86/fft.h -libavcodec/x86/fft_init.c libavcodec/x86/flac_dsp_gpl.asm libavcodec/x86/flacdsp.asm libavcodec/x86/flacdsp_init.c @@ -1923,8 +1933,6 @@ libavcodec/x86/hpeldsp.asm libavcodec/x86/hpeldsp.h libavcodec/x86/hpeldsp_init.c libavcodec/x86/hpeldsp_rnd_template.c -libavcodec/x86/hpeldsp_vp3.asm -libavcodec/x86/hpeldsp_vp3_init.c libavcodec/x86/huffyuvdsp.asm libavcodec/x86/huffyuvdsp_init.c libavcodec/x86/huffyuvdsp_template.asm @@ -2025,6 +2033,7 @@ libavcodec/x86/vp9lpf_16bpp.asm libavcodec/x86/vp9mc.asm libavcodec/x86/vp9mc_16bpp.asm libavcodec/x86/vpx_arith.h +libavcodec/x86/w64xmmtest.c libavcodec/x86/xvididct.asm libavcodec/x86/xvididct.h libavcodec/x86/xvididct_init.c @@ -2115,8 +2124,11 @@ libavdevice/xcbgrab.c libavdevice/xv.c libavfilter/Makefile libavfilter/aarch64/Makefile +libavfilter/aarch64/vf_bwdif_init_aarch64.c +libavfilter/aarch64/vf_bwdif_neon.S libavfilter/aarch64/vf_nlmeans_init.c libavfilter/aarch64/vf_nlmeans_neon.S +libavfilter/adynamicequalizer_template.c libavfilter/aeval.c libavfilter/af_acontrast.c libavfilter/af_acopy.c @@ -2158,6 +2170,7 @@ libavfilter/af_aphaser.c libavfilter/af_apsyclip.c libavfilter/af_apulsator.c libavfilter/af_aresample.c +libavfilter/af_arls.c libavfilter/af_arnndn.c libavfilter/af_asdr.c libavfilter/af_asetnsamples.c @@ -2257,7 +2270,10 @@ libavfilter/buffersink.c libavfilter/buffersink.h libavfilter/buffersrc.c libavfilter/buffersrc.h -libavfilter/bwdif.h +libavfilter/bwdifdsp.c +libavfilter/bwdifdsp.h +libavfilter/ccfifo.c +libavfilter/ccfifo.h libavfilter/colorchannelmixer_template.c libavfilter/colorspace.c libavfilter/colorspace.h @@ -2270,28 +2286,6 @@ libavfilter/deshake.h libavfilter/dnn/Makefile libavfilter/dnn/dnn_backend_common.c libavfilter/dnn/dnn_backend_common.h -libavfilter/dnn/dnn_backend_native.c -libavfilter/dnn/dnn_backend_native.h -libavfilter/dnn/dnn_backend_native_layer_avgpool.c -libavfilter/dnn/dnn_backend_native_layer_avgpool.h -libavfilter/dnn/dnn_backend_native_layer_conv2d.c -libavfilter/dnn/dnn_backend_native_layer_conv2d.h -libavfilter/dnn/dnn_backend_native_layer_dense.c -libavfilter/dnn/dnn_backend_native_layer_dense.h -libavfilter/dnn/dnn_backend_native_layer_depth2space.c -libavfilter/dnn/dnn_backend_native_layer_depth2space.h -libavfilter/dnn/dnn_backend_native_layer_mathbinary.c -libavfilter/dnn/dnn_backend_native_layer_mathbinary.h -libavfilter/dnn/dnn_backend_native_layer_mathunary.c -libavfilter/dnn/dnn_backend_native_layer_mathunary.h -libavfilter/dnn/dnn_backend_native_layer_maximum.c -libavfilter/dnn/dnn_backend_native_layer_maximum.h -libavfilter/dnn/dnn_backend_native_layer_pad.c -libavfilter/dnn/dnn_backend_native_layer_pad.h -libavfilter/dnn/dnn_backend_native_layers.c -libavfilter/dnn/dnn_backend_native_layers.h -libavfilter/dnn/dnn_backend_openvino.h -libavfilter/dnn/dnn_backend_tf.h libavfilter/dnn/dnn_interface.c libavfilter/dnn/dnn_io_proc.c libavfilter/dnn/dnn_io_proc.h @@ -2399,6 +2393,7 @@ libavfilter/setpts.c libavfilter/settb.c libavfilter/signature.h libavfilter/signature_lookup.c +libavfilter/silenceremove_template.c libavfilter/split.c libavfilter/src_avsynctest.c libavfilter/src_movie.c @@ -2443,7 +2438,9 @@ libavfilter/vf_blurdetect.c libavfilter/vf_bm3d.c libavfilter/vf_boxblur.c libavfilter/vf_bwdif.c +libavfilter/vf_bwdif_vulkan.c libavfilter/vf_cas.c +libavfilter/vf_ccrepack.c libavfilter/vf_chromaber_vulkan.c libavfilter/vf_chromakey.c libavfilter/vf_chromanr.c @@ -2569,6 +2566,7 @@ libavfilter/vf_maskedmerge.c libavfilter/vf_maskedminmax.c libavfilter/vf_maskedthreshold.c libavfilter/vf_maskfun.c +libavfilter/vf_mcdeint.c libavfilter/vf_median.c libavfilter/vf_mergeplanes.c libavfilter/vf_mestimate.c @@ -2587,6 +2585,7 @@ libavfilter/vf_nlmeans.c libavfilter/vf_nlmeans.h libavfilter/vf_nlmeans_init.h libavfilter/vf_nlmeans_opencl.c +libavfilter/vf_nlmeans_vulkan.c libavfilter/vf_nnedi.c libavfilter/vf_noise.c libavfilter/vf_noise.h @@ -2680,6 +2679,7 @@ libavfilter/vf_transpose_vulkan.c libavfilter/vf_unsharp.c libavfilter/vf_unsharp_opencl.c libavfilter/vf_untile.c +libavfilter/vf_uspp.c libavfilter/vf_v360.c libavfilter/vf_vaguedenoiser.c libavfilter/vf_varblur.c @@ -2699,6 +2699,7 @@ libavfilter/vf_weave.c libavfilter/vf_xbr.c libavfilter/vf_xfade.c libavfilter/vf_xfade_opencl.c +libavfilter/vf_xfade_vulkan.c libavfilter/vf_xmedian.c libavfilter/vf_yadif.c libavfilter/vf_yaepblur.c @@ -2717,10 +2718,13 @@ libavfilter/vsrc_mandelbrot.c libavfilter/vsrc_mptestsrc.c libavfilter/vsrc_sierpinski.c libavfilter/vsrc_testsrc.c +libavfilter/vsrc_testsrc_vulkan.c libavfilter/vulkan.c libavfilter/vulkan.h libavfilter/vulkan_filter.c libavfilter/vulkan_filter.h +libavfilter/vulkan_shaderc.c +libavfilter/vulkan_spirv.h libavfilter/w3fdif.h libavfilter/window_func.h libavfilter/x86/Makefile @@ -2811,6 +2815,8 @@ libavformat/aadec.c libavformat/aaxdec.c libavformat/ac3_channel_layout_tab.c libavformat/ac3dec.c +libavformat/ac4dec.c +libavformat/ac4enc.c libavformat/acedec.c libavformat/acm.c libavformat/act.c @@ -2942,6 +2948,9 @@ libavformat/dxa.c libavformat/eacdata.c libavformat/electronicarts.c libavformat/epafdec.c +libavformat/evc.c +libavformat/evc.h +libavformat/evcdec.c libavformat/ffmeta.h libavformat/ffmetadec.c libavformat/ffmetaenc.c @@ -3050,8 +3059,8 @@ libavformat/ivfenc.c libavformat/jacosubdec.c libavformat/jacosubenc.c libavformat/jpegtables.c -libavformat/jpegxl_probe.c -libavformat/jpegxl_probe.h +libavformat/jpegxl_anim_dec.c +libavformat/jpegxl_parse.c libavformat/jvdec.c libavformat/kvag.c libavformat/lafdec.c @@ -3178,11 +3187,13 @@ libavformat/options.c libavformat/options_table.h libavformat/os_support.c libavformat/os_support.h +libavformat/osq.c libavformat/paf.c libavformat/pcm.c libavformat/pcm.h libavformat/pcmdec.c libavformat/pcmenc.c +libavformat/pdvdec.c libavformat/pjsdec.c libavformat/pmpdec.c libavformat/pp_bnk.c @@ -3195,6 +3206,7 @@ libavformat/qcp.c libavformat/qtpalette.c libavformat/qtpalette.h libavformat/r3d.c +libavformat/rangecoder_dec.c libavformat/rawdec.c libavformat/rawdec.h libavformat/rawenc.c @@ -3380,6 +3392,7 @@ libavformat/url.c libavformat/url.h libavformat/urldecode.c libavformat/urldecode.h +libavformat/usmdec.c libavformat/utils.c libavformat/vag.c libavformat/vapoursynth.c @@ -3403,6 +3416,7 @@ libavformat/vpcc.h libavformat/vpk.c libavformat/vplayerdec.c libavformat/vqf.c +libavformat/vvcdec.c libavformat/w64.c libavformat/w64.h libavformat/wady.c @@ -3482,7 +3496,6 @@ libavutil/avstring.h libavutil/avutil.h libavutil/base64.c libavutil/base64.h -libavutil/bfin/timer.h libavutil/blowfish.c libavutil/blowfish.h libavutil/bprint.c @@ -3521,12 +3534,15 @@ libavutil/dovi_meta.h libavutil/downmix_info.c libavutil/downmix_info.h libavutil/dynarray.h +libavutil/emms.h libavutil/encryption_info.c libavutil/encryption_info.h libavutil/error.c libavutil/error.h libavutil/eval.c libavutil/eval.h +libavutil/executor.c +libavutil/executor.h libavutil/ffmath.h libavutil/fifo.c libavutil/fifo.h @@ -3709,12 +3725,12 @@ libavutil/version.h libavutil/version_major.h libavutil/video_enc_params.c libavutil/video_enc_params.h +libavutil/video_hint.c +libavutil/video_hint.h libavutil/vulkan.c libavutil/vulkan.h libavutil/vulkan_functions.h -libavutil/vulkan_glslang.c libavutil/vulkan_loader.h -libavutil/vulkan_shaderc.c libavutil/wchar_filename.h libavutil/x86/Makefile libavutil/x86/asm.h @@ -3723,7 +3739,6 @@ libavutil/x86/cpu.c libavutil/x86/cpu.h libavutil/x86/cpuid.asm libavutil/x86/emms.asm -libavutil/x86/emms.h libavutil/x86/fixed_dsp.asm libavutil/x86/fixed_dsp_init.c libavutil/x86/float_dsp.asm @@ -3943,15 +3958,14 @@ tests/fate/cover-art.mak tests/fate/dca.mak tests/fate/demux.mak tests/fate/dfa.mak -tests/fate/dnn.mak tests/fate/dnxhd.mak tests/fate/dpcm.mak tests/fate/dvvideo.mak tests/fate/ea.mak +tests/fate/enc_external.mak tests/fate/exif.mak tests/fate/ffmpeg.mak tests/fate/ffprobe.mak -tests/fate/fft.mak tests/fate/fifo-muxer.mak tests/fate/filter-audio.mak tests/fate/filter-video.mak @@ -3969,6 +3983,8 @@ tests/fate/id3v2.mak tests/fate/image.mak tests/fate/imf.mak tests/fate/indeo.mak +tests/fate/jpeg2000.mak +tests/fate/jxl.mak tests/fate/lavf-audio.mak tests/fate/lavf-container.mak tests/fate/lavf-image.mak @@ -4026,11 +4042,11 @@ tests/fate/wma.mak tests/fate/xvid.mak tools/Makefile tools/aviocat.c -tools/cl2c tools/crypto_bench.c tools/cws2fws.c tools/decode_simple.c tools/decode_simple.h +tools/enc_recon_frame_test.c tools/enum_options.c tools/ffescape.c tools/ffeval.c @@ -4045,6 +4061,7 @@ tools/scale_slice_test.c tools/seek_print.c tools/sidxindex.c tools/sofa2wavs.c +tools/source2c tools/trasher.c tools/uncoded_frame.c tools/venc_data_dump.c diff --git a/sources b/sources index c3587ce..537a8b7 100644 --- a/sources +++ b/sources @@ -1,4 +1,4 @@ -SHA512 (ffmpeg-free-6.0.1.tar.xz) = da4aa6db92fbbfdda9fc64249a0c826ae5de33cacbed5ebbfbbe9a30d57ae6f79b61496fcf151dc504d646efd44ba63722220be0b718dd8ffdaa5b2510d92a97 -SHA512 (ffmpeg-6.0.1.tar.xz.asc) = 314f9ef996b85bc93c9fb823d582697c7415ac35f56bfc9cd906893491c8076df90bd852cf6e5e757b1fa94bd415ed108488c1220add49eb1f4854fc253c178c +SHA512 (ffmpeg-free-6.1.tar.xz) = eb2c0906b659a81f061e508b5c5004efd3fdb8299f2a5e4e954e1dd0589770baccfda768fa9d3e39bde1e1d8644c42015e0f6f674ab96a94776c69aad515d72d +SHA512 (ffmpeg-6.1.tar.xz.asc) = e4885270869cc6a1681bc3f76f344f77c4858c490a517e45a758d15214ce67c3c2113a1caa8ca65eb6447b68d822fa1dd730081345bcc0928faaf82bb76037ba SHA512 (ffmpeg-dlopen-headers.tar.xz) = 97e6986fc2bb9dfa4516135a76b04d27ceb52ff96f0af21a6169919aeefefb4d2e2e24a771959689cdbec385f5d71614ba661223c67c0e94089a6dd823a30099 SHA512 (ffmpeg.keyring) = 9b36506835db36f776b7ddb53ad6fa9e915e6ca2f9c7cfebe8eb45513e1036a985283590a840ca313a111bf35dc3731f68885aaafb1fb7011ec433cc119e5165 From f3982b50da8b89a2437456a847f4363f485beff6 Mon Sep 17 00:00:00 2001 From: Neal Gompa Date: Thu, 4 Jan 2024 11:04:37 -0500 Subject: [PATCH 25/95] Update to 6.1.1 --- ...ild-vulkan-decode-code-if-vulkan_av1.patch | 27 ------------------- ffmpeg.spec | 8 +++--- sources | 4 +-- 3 files changed, 6 insertions(+), 33 deletions(-) delete mode 100644 0001-lavc-Makefile-build-vulkan-decode-code-if-vulkan_av1.patch diff --git a/0001-lavc-Makefile-build-vulkan-decode-code-if-vulkan_av1.patch b/0001-lavc-Makefile-build-vulkan-decode-code-if-vulkan_av1.patch deleted file mode 100644 index 021aaae..0000000 --- a/0001-lavc-Makefile-build-vulkan-decode-code-if-vulkan_av1.patch +++ /dev/null @@ -1,27 +0,0 @@ -From b7c696af10784110844cc3dbe0ec21538393f309 Mon Sep 17 00:00:00 2001 -From: Lynne -Date: Sun, 3 Dec 2023 21:02:13 +0100 -Subject: [PATCH] lavc/Makefile: build vulkan decode code if vulkan_av1 has - been enabled - -Forgotten. ---- - libavcodec/Makefile | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/libavcodec/Makefile b/libavcodec/Makefile -index 748806e702..fd9883d2ca 100644 ---- a/libavcodec/Makefile -+++ b/libavcodec/Makefile -@@ -998,7 +998,7 @@ OBJS-$(CONFIG_AV1_DXVA2_HWACCEL) += dxva2_av1.o - OBJS-$(CONFIG_AV1_NVDEC_HWACCEL) += nvdec_av1.o - OBJS-$(CONFIG_AV1_VAAPI_HWACCEL) += vaapi_av1.o - OBJS-$(CONFIG_AV1_VDPAU_HWACCEL) += vdpau_av1.o --OBJS-$(CONFIG_AV1_VULKAN_HWACCEL) += vulkan_av1.o -+OBJS-$(CONFIG_AV1_VULKAN_HWACCEL) += vulkan_decode.o vulkan_av1.o - OBJS-$(CONFIG_H263_VAAPI_HWACCEL) += vaapi_mpeg4.o - OBJS-$(CONFIG_H263_VIDEOTOOLBOX_HWACCEL) += videotoolbox.o - OBJS-$(CONFIG_H264_D3D11VA_HWACCEL) += dxva2_h264.o --- -2.43.0 - diff --git a/ffmpeg.spec b/ffmpeg.spec index f2e147b..48e9732 100644 --- a/ffmpeg.spec +++ b/ffmpeg.spec @@ -91,7 +91,7 @@ Name: ffmpeg %global pkg_name %{name}%{?pkg_suffix} -Version: 6.1 +Version: 6.1.1 Release: 1%{?dist} Summary: A complete solution to record, convert and stream audio and video License: GPL-3.0-or-later @@ -116,9 +116,6 @@ Patch1: ffmpeg-codec-choice.patch # Allow to build with fdk-aac-free # See https://bugzilla.redhat.com/show_bug.cgi?id=1501522#c112 Patch2: ffmpeg-allow-fdk-aac-free.patch -# Backport fix for Vulkan Video with only AV1 -# From: https://ffmpeg.org/pipermail/ffmpeg-devel/2023-December/317728.html -Patch3: 0001-lavc-Makefile-build-vulkan-decode-code-if-vulkan_av1.patch # Drop openh264 runtime version checks # https://patchwork.ffmpeg.org/project/ffmpeg/list/?series=10211 Patch4: 0001-lavc-libopenh264-Drop-openh264-runtime-version-check.patch @@ -863,6 +860,9 @@ rm -rf %{buildroot}%{_datadir}/%{name}/examples %{_mandir}/man3/libswscale.3* %changelog +* Thu Jan 04 2024 Neal Gompa - 6.1.1-1 +- Update to 6.1.1 + * Thu Jan 04 2024 Neal Gompa - 6.1-1 - Rebase to 6.1 diff --git a/sources b/sources index 537a8b7..932881f 100644 --- a/sources +++ b/sources @@ -1,4 +1,4 @@ -SHA512 (ffmpeg-free-6.1.tar.xz) = eb2c0906b659a81f061e508b5c5004efd3fdb8299f2a5e4e954e1dd0589770baccfda768fa9d3e39bde1e1d8644c42015e0f6f674ab96a94776c69aad515d72d -SHA512 (ffmpeg-6.1.tar.xz.asc) = e4885270869cc6a1681bc3f76f344f77c4858c490a517e45a758d15214ce67c3c2113a1caa8ca65eb6447b68d822fa1dd730081345bcc0928faaf82bb76037ba +SHA512 (ffmpeg-free-6.1.1.tar.xz) = 4fdecf8316bc038839a1d05116630f47e4d75d3b25fa6b3480f9e654d5677c7996c6a2a83f93f4520e175a79843da05a987aeda24c9a6e7495079a808309569b +SHA512 (ffmpeg-6.1.1.tar.xz.asc) = 0e10c1f560bab0812d759d286656593dea5940f02bb52d88d9ba7f10b12b9cc3d7aa2a41c5f7a45b319069e04dce22dc1286b3c1ba685b35cd6d04cd81c5a0f5 SHA512 (ffmpeg-dlopen-headers.tar.xz) = 97e6986fc2bb9dfa4516135a76b04d27ceb52ff96f0af21a6169919aeefefb4d2e2e24a771959689cdbec385f5d71614ba661223c67c0e94089a6dd823a30099 SHA512 (ffmpeg.keyring) = 9b36506835db36f776b7ddb53ad6fa9e915e6ca2f9c7cfebe8eb45513e1036a985283590a840ca313a111bf35dc3731f68885aaafb1fb7011ec433cc119e5165 From b05e4ff5576598302a21fdd9c0c9b7c6e526f352 Mon Sep 17 00:00:00 2001 From: Florian Weimer Date: Fri, 5 Jan 2024 15:48:35 +0100 Subject: [PATCH 26/95] Backport upstream patch to fix C compatibility issues Related to: --- ffmpeg-c99.patch | 67 ++++++++++++++++++++++++++++++++++++++++++++++++ ffmpeg.spec | 6 ++++- 2 files changed, 72 insertions(+), 1 deletion(-) create mode 100644 ffmpeg-c99.patch diff --git a/ffmpeg-c99.patch b/ffmpeg-c99.patch new file mode 100644 index 0000000..0ae4d8a --- /dev/null +++ b/ffmpeg-c99.patch @@ -0,0 +1,67 @@ +From 42982b5a5d461530a792e69b3e8abdd9d6d67052 Mon Sep 17 00:00:00 2001 +From: Frank Plowman +Date: Fri, 22 Dec 2023 12:00:01 +0000 +Subject: [PATCH] avformat/ffrtmpcrypt: Fix int-conversion warning +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit +Content-type: text/plain + +The gcrypt definition of `bn_new` used to use the return statement +on errors, with an AVERROR return value, regardless of the signature +of the function where the macro is used - it is called in +`dh_generate_key` and `ff_dh_init` which return pointers. As a result, +compiling with gcrypt and the ffrtmpcrypt protocol resulted in an +int-conversion warning. GCC 14 may upgrade these to errors [1]. + +This patch fixes the problem by changing the macro to remove `AVERROR` +and instead set `bn` to null if the allocation fails. This is the +behaviour of all the other `bn_new` implementations and so the result is +already checked at all the callsites. AFAICT, this should be the only +change needed to get ffmpeg off Fedora's naughty list of projects with +warnings which may be upgraded to errors in GCC 14 [2]. + +[1]: https://gcc.gnu.org/pipermail/gcc/2023-May/241264.html +[2]: https://www.mail-archive.com/devel@lists.fedoraproject.org/msg196024.html + +Signed-off-by: Frank Plowman +Signed-off-by: Martin Storsjö +--- + libavformat/rtmpdh.c | 21 ++++++++++++--------- + 1 file changed, 12 insertions(+), 9 deletions(-) + +diff --git a/libavformat/rtmpdh.c b/libavformat/rtmpdh.c +index 5ddae537a1..6a6c2ccd87 100644 +--- a/libavformat/rtmpdh.c ++++ b/libavformat/rtmpdh.c +@@ -113,15 +113,18 @@ static int bn_modexp(FFBigNum bn, FFBigNum y, FFBigNum q, FFBigNum p) + return 0; + } + #elif CONFIG_GCRYPT +-#define bn_new(bn) \ +- do { \ +- if (!gcry_control(GCRYCTL_INITIALIZATION_FINISHED_P)) { \ +- if (!gcry_check_version("1.5.4")) \ +- return AVERROR(EINVAL); \ +- gcry_control(GCRYCTL_DISABLE_SECMEM, 0); \ +- gcry_control(GCRYCTL_INITIALIZATION_FINISHED, 0); \ +- } \ +- bn = gcry_mpi_new(1); \ ++#define bn_new(bn) \ ++ do { \ ++ if (!gcry_control(GCRYCTL_INITIALIZATION_FINISHED_P)) { \ ++ if (gcry_check_version("1.5.4")) { \ ++ gcry_control(GCRYCTL_DISABLE_SECMEM, 0); \ ++ gcry_control(GCRYCTL_INITIALIZATION_FINISHED, 0); \ ++ } \ ++ } \ ++ if (gcry_control(GCRYCTL_INITIALIZATION_FINISHED_P)) \ ++ bn = gcry_mpi_new(1); \ ++ else \ ++ bn = NULL; \ + } while (0) + #define bn_free(bn) gcry_mpi_release(bn) + #define bn_set_word(bn, w) gcry_mpi_set_ui(bn, w) +-- +2.43.0 + diff --git a/ffmpeg.spec b/ffmpeg.spec index 48e9732..fc2de36 100644 --- a/ffmpeg.spec +++ b/ffmpeg.spec @@ -92,7 +92,7 @@ Name: ffmpeg %global pkg_name %{name}%{?pkg_suffix} Version: 6.1.1 -Release: 1%{?dist} +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/ @@ -119,6 +119,7 @@ Patch2: ffmpeg-allow-fdk-aac-free.patch # Drop openh264 runtime version checks # https://patchwork.ffmpeg.org/project/ffmpeg/list/?series=10211 Patch4: 0001-lavc-libopenh264-Drop-openh264-runtime-version-check.patch +Patch5: ffmpeg-c99.patch # Set up dlopen for openh264 Patch1001: ffmpeg-dlopen-openh264.patch @@ -860,6 +861,9 @@ rm -rf %{buildroot}%{_datadir}/%{name}/examples %{_mandir}/man3/libswscale.3* %changelog +* Fri Jan 05 2024 Florian Weimer - 6.1.1-2 +- Backport upstream patch to fix C compatibility issues + * Thu Jan 04 2024 Neal Gompa - 6.1.1-1 - Update to 6.1.1 From e4f0babc7962e35cae66e2dac6df00091b73013e Mon Sep 17 00:00:00 2001 From: Fabio Valentini Date: Fri, 12 Jan 2024 18:18:42 +0100 Subject: [PATCH 27/95] Rebuild for dav1d 1.3.0 --- ffmpeg.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ffmpeg.spec b/ffmpeg.spec index fc2de36..396fab5 100644 --- a/ffmpeg.spec +++ b/ffmpeg.spec @@ -92,7 +92,7 @@ Name: ffmpeg %global pkg_name %{name}%{?pkg_suffix} Version: 6.1.1 -Release: 2%{?dist} +Release: 3%{?dist} Summary: A complete solution to record, convert and stream audio and video License: GPL-3.0-or-later URL: https://ffmpeg.org/ @@ -861,6 +861,9 @@ rm -rf %{buildroot}%{_datadir}/%{name}/examples %{_mandir}/man3/libswscale.3* %changelog +* Fri Jan 12 2024 Fabio Valentini - 6.1.1-3 +- Rebuild for dav1d 1.3.0 + * Fri Jan 05 2024 Florian Weimer - 6.1.1-2 - Backport upstream patch to fix C compatibility issues From bea10e455bc90d8822e1a502978e79095e62c842 Mon Sep 17 00:00:00 2001 From: Neal Gompa Date: Mon, 15 Jan 2024 10:55:52 -0500 Subject: [PATCH 28/95] Add missing files for some of the libraries to fix riscv64 builds --- ffmpeg.spec | 5 ++++- ffmpeg_free_sources | 10 ++++++++++ sources | 2 +- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/ffmpeg.spec b/ffmpeg.spec index 396fab5..4e8cb6e 100644 --- a/ffmpeg.spec +++ b/ffmpeg.spec @@ -92,7 +92,7 @@ Name: ffmpeg %global pkg_name %{name}%{?pkg_suffix} Version: 6.1.1 -Release: 3%{?dist} +Release: 4%{?dist} Summary: A complete solution to record, convert and stream audio and video License: GPL-3.0-or-later URL: https://ffmpeg.org/ @@ -861,6 +861,9 @@ rm -rf %{buildroot}%{_datadir}/%{name}/examples %{_mandir}/man3/libswscale.3* %changelog +* Mon Jan 15 2024 Neal Gompa - 6.1.1-4 +- Add missing files for some of the libraries to fix riscv64 builds + * Fri Jan 12 2024 Fabio Valentini - 6.1.1-3 - Rebuild for dav1d 1.3.0 diff --git a/ffmpeg_free_sources b/ffmpeg_free_sources index 9830b45..c3be5a0 100644 --- a/ffmpeg_free_sources +++ b/ffmpeg_free_sources @@ -3479,11 +3479,13 @@ libavutil/arm/cpu.c libavutil/arm/cpu.h libavutil/arm/float_dsp_arm.h libavutil/arm/float_dsp_init_arm.c +libavutil/arm/float_dsp_init_neon.c libavutil/arm/float_dsp_init_vfp.c libavutil/arm/float_dsp_neon.S libavutil/arm/float_dsp_vfp.S libavutil/arm/intmath.h libavutil/arm/intreadwrite.h +libavutil/arm/neontest.h libavutil/arm/timer.h libavutil/attributes.h libavutil/attributes_internal.h @@ -3670,6 +3672,7 @@ libavutil/ripemd.h libavutil/riscv/Makefile libavutil/riscv/asm.S libavutil/riscv/bswap.h +libavutil/riscv/bswap_rvb.S libavutil/riscv/cpu.c libavutil/riscv/cpu.h libavutil/riscv/fixed_dsp_init.c @@ -3755,6 +3758,7 @@ libavutil/x86/pixelutils_init.c libavutil/x86/timer.h libavutil/x86/tx_float.asm libavutil/x86/tx_float_init.c +libavutil/x86/w64xmmtest.h libavutil/x86/x86inc.asm libavutil/x86/x86util.asm libavutil/xga_font_data.c @@ -3775,11 +3779,13 @@ libswresample/Makefile libswresample/aarch64/Makefile libswresample/aarch64/audio_convert_init.c libswresample/aarch64/audio_convert_neon.S +libswresample/aarch64/neontest.c libswresample/aarch64/resample.S libswresample/aarch64/resample_init.c libswresample/arm/Makefile libswresample/arm/audio_convert_init.c libswresample/arm/audio_convert_neon.S +libswresample/arm/neontest.c libswresample/arm/resample.S libswresample/arm/resample_init.c libswresample/audioconvert.c @@ -3811,6 +3817,7 @@ libswresample/x86/rematrix.asm libswresample/x86/rematrix_init.c libswresample/x86/resample.asm libswresample/x86/resample_init.c +libswresample/x86/w64xmmtest.c libswscale/Makefile libswscale/aarch64/Makefile libswscale/aarch64/hscale.S @@ -3826,6 +3833,7 @@ libswscale/arm/hscale.S libswscale/arm/output.S libswscale/arm/rgb2yuv_neon_16.S libswscale/arm/rgb2yuv_neon_32.S +libswscale/arm/rgb2yuv_neon_common.S libswscale/arm/swscale.c libswscale/arm/swscale_unscaled.c libswscale/arm/yuv2rgb_neon.S @@ -3851,6 +3859,7 @@ libswscale/rgb2rgb.h libswscale/rgb2rgb_template.c libswscale/riscv/Makefile libswscale/riscv/rgb2rgb.c +libswscale/riscv/rgb2rgb_rvb.S libswscale/riscv/rgb2rgb_rvv.S libswscale/slice.c libswscale/swscale.c @@ -3873,6 +3882,7 @@ libswscale/x86/scale.asm libswscale/x86/scale_avx2.asm libswscale/x86/swscale.c libswscale/x86/swscale_template.c +libswscale/x86/w64xmmtest.c libswscale/x86/yuv2rgb.c libswscale/x86/yuv2rgb_template.c libswscale/x86/yuv2yuvX.asm diff --git a/sources b/sources index 932881f..f142d78 100644 --- a/sources +++ b/sources @@ -1,4 +1,4 @@ -SHA512 (ffmpeg-free-6.1.1.tar.xz) = 4fdecf8316bc038839a1d05116630f47e4d75d3b25fa6b3480f9e654d5677c7996c6a2a83f93f4520e175a79843da05a987aeda24c9a6e7495079a808309569b +SHA512 (ffmpeg-free-6.1.1.tar.xz) = f7ca7901b7affa45fd6016b7ac2d7f843f89ad7f813c6f37228d184842aa55167429585e172d3da61ca1ef64818d563199faa7d06295eea1fd829696d28fa044 SHA512 (ffmpeg-6.1.1.tar.xz.asc) = 0e10c1f560bab0812d759d286656593dea5940f02bb52d88d9ba7f10b12b9cc3d7aa2a41c5f7a45b319069e04dce22dc1286b3c1ba685b35cd6d04cd81c5a0f5 SHA512 (ffmpeg-dlopen-headers.tar.xz) = 97e6986fc2bb9dfa4516135a76b04d27ceb52ff96f0af21a6169919aeefefb4d2e2e24a771959689cdbec385f5d71614ba661223c67c0e94089a6dd823a30099 SHA512 (ffmpeg.keyring) = 9b36506835db36f776b7ddb53ad6fa9e915e6ca2f9c7cfebe8eb45513e1036a985283590a840ca313a111bf35dc3731f68885aaafb1fb7011ec433cc119e5165 From 2fe1d67c6da9a6411c171264df11d30378bd1d9b Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Fri, 19 Jan 2024 19:15:07 +0000 Subject: [PATCH 29/95] Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild --- ffmpeg.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ffmpeg.spec b/ffmpeg.spec index 4e8cb6e..906f3eb 100644 --- a/ffmpeg.spec +++ b/ffmpeg.spec @@ -92,7 +92,7 @@ Name: ffmpeg %global pkg_name %{name}%{?pkg_suffix} Version: 6.1.1 -Release: 4%{?dist} +Release: 5%{?dist} Summary: A complete solution to record, convert and stream audio and video License: GPL-3.0-or-later URL: https://ffmpeg.org/ @@ -861,6 +861,9 @@ rm -rf %{buildroot}%{_datadir}/%{name}/examples %{_mandir}/man3/libswscale.3* %changelog +* Fri Jan 19 2024 Fedora Release Engineering - 6.1.1-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + * Mon Jan 15 2024 Neal Gompa - 6.1.1-4 - Add missing files for some of the libraries to fix riscv64 builds From 5b76b460705a7a7c5f8faa854bf384682143c679 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Wed, 24 Jan 2024 11:31:07 +0000 Subject: [PATCH 30/95] Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild --- ffmpeg.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ffmpeg.spec b/ffmpeg.spec index 906f3eb..3f6e437 100644 --- a/ffmpeg.spec +++ b/ffmpeg.spec @@ -92,7 +92,7 @@ Name: ffmpeg %global pkg_name %{name}%{?pkg_suffix} Version: 6.1.1 -Release: 5%{?dist} +Release: 6%{?dist} Summary: A complete solution to record, convert and stream audio and video License: GPL-3.0-or-later URL: https://ffmpeg.org/ @@ -861,6 +861,9 @@ rm -rf %{buildroot}%{_datadir}/%{name}/examples %{_mandir}/man3/libswscale.3* %changelog +* Wed Jan 24 2024 Fedora Release Engineering - 6.1.1-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + * Fri Jan 19 2024 Fedora Release Engineering - 6.1.1-5 - Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild From 1a68b3097081bfa7435e15198119b02f79d3f553 Mon Sep 17 00:00:00 2001 From: Sandro Mani Date: Sun, 28 Jan 2024 11:32:35 +0100 Subject: [PATCH 31/95] Rebuild (tesseract) --- ffmpeg.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ffmpeg.spec b/ffmpeg.spec index 3f6e437..49adee5 100644 --- a/ffmpeg.spec +++ b/ffmpeg.spec @@ -92,7 +92,7 @@ Name: ffmpeg %global pkg_name %{name}%{?pkg_suffix} Version: 6.1.1 -Release: 6%{?dist} +Release: 7%{?dist} Summary: A complete solution to record, convert and stream audio and video License: GPL-3.0-or-later URL: https://ffmpeg.org/ @@ -861,6 +861,9 @@ rm -rf %{buildroot}%{_datadir}/%{name}/examples %{_mandir}/man3/libswscale.3* %changelog +* Sun Jan 28 2024 Sandro Mani - 6.1.1-7 +- Rebuild (tesseract) + * Wed Jan 24 2024 Fedora Release Engineering - 6.1.1-6 - Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild From b58631f03075084b20b0c7066ca8212707429388 Mon Sep 17 00:00:00 2001 From: Nicolas Chauvet Date: Wed, 31 Jan 2024 14:35:53 +0100 Subject: [PATCH 32/95] Backport patch to fix -Wint-conversion for gcc-14 https://trac.ffmpeg.org/ticket/10833 --- ffmpeg.spec | 3 ++ ...c_testsrc_vulkan-fix-Wint-conversion.patch | 38 +++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 lavfi-vsrc_testsrc_vulkan-fix-Wint-conversion.patch diff --git a/ffmpeg.spec b/ffmpeg.spec index 49adee5..120554b 100644 --- a/ffmpeg.spec +++ b/ffmpeg.spec @@ -120,6 +120,9 @@ Patch2: ffmpeg-allow-fdk-aac-free.patch # https://patchwork.ffmpeg.org/project/ffmpeg/list/?series=10211 Patch4: 0001-lavc-libopenh264-Drop-openh264-runtime-version-check.patch Patch5: ffmpeg-c99.patch +# Upstream report/patch for gcc-14 to fix -Wint-conversion +# https://trac.ffmpeg.org/ticket/10833 +Patch6: lavfi-vsrc_testsrc_vulkan-fix-Wint-conversion.patch # Set up dlopen for openh264 Patch1001: ffmpeg-dlopen-openh264.patch diff --git a/lavfi-vsrc_testsrc_vulkan-fix-Wint-conversion.patch b/lavfi-vsrc_testsrc_vulkan-fix-Wint-conversion.patch new file mode 100644 index 0000000..ad62b7a --- /dev/null +++ b/lavfi-vsrc_testsrc_vulkan-fix-Wint-conversion.patch @@ -0,0 +1,38 @@ +From 5860a966d2fffbbda1af0014f0a4d37a21c4f2ca Mon Sep 17 00:00:00 2001 +From: Lynne +Date: Wed, 31 Jan 2024 14:15:04 +0100 +Subject: [PATCH] lavfi/vsrc_testsrc_vulkan: fix -Wint-conversion + +While VK_NULL_HANDLE is equivalent to NULL on 64-bit platforms, the same is not +true across all platforms. + +Fixes building with gcc-14. +--- + libavfilter/vsrc_testsrc_vulkan.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/libavfilter/vsrc_testsrc_vulkan.c b/libavfilter/vsrc_testsrc_vulkan.c +index 8761c21dfd1e..1720bfac5e3a 100644 +--- a/libavfilter/vsrc_testsrc_vulkan.c ++++ b/libavfilter/vsrc_testsrc_vulkan.c +@@ -231,7 +231,7 @@ static int testsrc_vulkan_activate(AVFilterContext *ctx) + return AVERROR(ENOMEM); + + err = ff_vk_filter_process_simple(&s->vkctx, &s->e, &s->pl, s->picref, NULL, +- NULL, &s->opts, sizeof(s->opts)); ++ VK_NULL_HANDLE, &s->opts, sizeof(s->opts)); + if (err < 0) + return err; + } +@@ -250,7 +250,7 @@ static int testsrc_vulkan_activate(AVFilterContext *ctx) + frame->sample_aspect_ratio = s->sar; + if (!s->draw_once) { + err = ff_vk_filter_process_simple(&s->vkctx, &s->e, &s->pl, frame, NULL, +- NULL, &s->opts, sizeof(s->opts)); ++ VK_NULL_HANDLE, &s->opts, sizeof(s->opts)); + if (err < 0) { + av_frame_free(&frame); + return err; +-- +2.42.0 + From 67cc0fa210d0fbeb0dfffa18c2b2165b44d92970 Mon Sep 17 00:00:00 2001 From: Dominik 'Rathann' Mierzejewski Date: Wed, 31 Jan 2024 16:28:56 +0100 Subject: [PATCH 33/95] Revert "Backport patch to fix -Wint-conversion for gcc-14" This reverts commit b58631f03075084b20b0c7066ca8212707429388. This change is not a complete fix. A complete fix is provided in https://src.fedoraproject.org/rpms/ffmpeg/pull-request/23 . This revert is necessary for the PR to be mergeable again. --- ffmpeg.spec | 3 -- ...c_testsrc_vulkan-fix-Wint-conversion.patch | 38 ------------------- 2 files changed, 41 deletions(-) delete mode 100644 lavfi-vsrc_testsrc_vulkan-fix-Wint-conversion.patch diff --git a/ffmpeg.spec b/ffmpeg.spec index 120554b..49adee5 100644 --- a/ffmpeg.spec +++ b/ffmpeg.spec @@ -120,9 +120,6 @@ Patch2: ffmpeg-allow-fdk-aac-free.patch # https://patchwork.ffmpeg.org/project/ffmpeg/list/?series=10211 Patch4: 0001-lavc-libopenh264-Drop-openh264-runtime-version-check.patch Patch5: ffmpeg-c99.patch -# Upstream report/patch for gcc-14 to fix -Wint-conversion -# https://trac.ffmpeg.org/ticket/10833 -Patch6: lavfi-vsrc_testsrc_vulkan-fix-Wint-conversion.patch # Set up dlopen for openh264 Patch1001: ffmpeg-dlopen-openh264.patch diff --git a/lavfi-vsrc_testsrc_vulkan-fix-Wint-conversion.patch b/lavfi-vsrc_testsrc_vulkan-fix-Wint-conversion.patch deleted file mode 100644 index ad62b7a..0000000 --- a/lavfi-vsrc_testsrc_vulkan-fix-Wint-conversion.patch +++ /dev/null @@ -1,38 +0,0 @@ -From 5860a966d2fffbbda1af0014f0a4d37a21c4f2ca Mon Sep 17 00:00:00 2001 -From: Lynne -Date: Wed, 31 Jan 2024 14:15:04 +0100 -Subject: [PATCH] lavfi/vsrc_testsrc_vulkan: fix -Wint-conversion - -While VK_NULL_HANDLE is equivalent to NULL on 64-bit platforms, the same is not -true across all platforms. - -Fixes building with gcc-14. ---- - libavfilter/vsrc_testsrc_vulkan.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/libavfilter/vsrc_testsrc_vulkan.c b/libavfilter/vsrc_testsrc_vulkan.c -index 8761c21dfd1e..1720bfac5e3a 100644 ---- a/libavfilter/vsrc_testsrc_vulkan.c -+++ b/libavfilter/vsrc_testsrc_vulkan.c -@@ -231,7 +231,7 @@ static int testsrc_vulkan_activate(AVFilterContext *ctx) - return AVERROR(ENOMEM); - - err = ff_vk_filter_process_simple(&s->vkctx, &s->e, &s->pl, s->picref, NULL, -- NULL, &s->opts, sizeof(s->opts)); -+ VK_NULL_HANDLE, &s->opts, sizeof(s->opts)); - if (err < 0) - return err; - } -@@ -250,7 +250,7 @@ static int testsrc_vulkan_activate(AVFilterContext *ctx) - frame->sample_aspect_ratio = s->sar; - if (!s->draw_once) { - err = ff_vk_filter_process_simple(&s->vkctx, &s->e, &s->pl, frame, NULL, -- NULL, &s->opts, sizeof(s->opts)); -+ VK_NULL_HANDLE, &s->opts, sizeof(s->opts)); - if (err < 0) { - av_frame_free(&frame); - return err; --- -2.42.0 - From 774d42a0072430fdef97ce11b40bdec97bf925ad Mon Sep 17 00:00:00 2001 From: Sandro Mani Date: Tue, 30 Jan 2024 12:06:36 +0100 Subject: [PATCH 34/95] Fix build with gcc14 (-Wint-conversion, -Wincompatible-pointer-types) --- ffmpeg-gcc14.patch | 131 +++++++++++++++++++++++++++++++++++++++++++++ ffmpeg.spec | 2 + 2 files changed, 133 insertions(+) create mode 100644 ffmpeg-gcc14.patch diff --git a/ffmpeg-gcc14.patch b/ffmpeg-gcc14.patch new file mode 100644 index 0000000..99dd6af --- /dev/null +++ b/ffmpeg-gcc14.patch @@ -0,0 +1,131 @@ +From 68ef9a29478fad450ec29ec14120afad3938e75b Mon Sep 17 00:00:00 2001 +From: Sandro Mani +Date: Tue, 30 Jan 2024 09:16:13 +0100 +Subject: [PATCH] Fix -Wint-conversion and -Wincompatible-pointer-types errors + +--- + libavcodec/pcm-bluray.c | 4 ++-- + libavcodec/pcm-dvd.c | 2 +- + libavcodec/vulkan_av1.c | 2 +- + libavcodec/vulkan_decode.c | 6 +++--- + libavcodec/vulkan_video.c | 2 +- + libavfilter/vsrc_testsrc_vulkan.c | 4 ++-- + libavutil/hwcontext_vaapi.c | 2 +- + 7 files changed, 11 insertions(+), 11 deletions(-) + +diff --git a/libavcodec/pcm-bluray.c b/libavcodec/pcm-bluray.c +index f656095..56fa373 100644 +--- a/libavcodec/pcm-bluray.c ++++ b/libavcodec/pcm-bluray.c +@@ -167,7 +167,7 @@ static int pcm_bluray_decode_frame(AVCodecContext *avctx, AVFrame *frame, + samples *= num_source_channels; + if (AV_SAMPLE_FMT_S16 == avctx->sample_fmt) { + #if HAVE_BIGENDIAN +- bytestream2_get_buffer(&gb, dst16, buf_size); ++ bytestream2_get_buffer(&gb, (uint8_t*)dst16, buf_size); + #else + do { + *dst16++ = bytestream2_get_be16u(&gb); +@@ -187,7 +187,7 @@ static int pcm_bluray_decode_frame(AVCodecContext *avctx, AVFrame *frame, + if (AV_SAMPLE_FMT_S16 == avctx->sample_fmt) { + do { + #if HAVE_BIGENDIAN +- bytestream2_get_buffer(&gb, dst16, avctx->ch_layout.nb_channels * 2); ++ bytestream2_get_buffer(&gb, (uint8_t*)dst16, avctx->ch_layout.nb_channels * 2); + dst16 += avctx->ch_layout.nb_channels; + #else + channel = avctx->ch_layout.nb_channels; +diff --git a/libavcodec/pcm-dvd.c b/libavcodec/pcm-dvd.c +index 419b2a1..319746c 100644 +--- a/libavcodec/pcm-dvd.c ++++ b/libavcodec/pcm-dvd.c +@@ -157,7 +157,7 @@ static void *pcm_dvd_decode_samples(AVCodecContext *avctx, const uint8_t *src, + switch (avctx->bits_per_coded_sample) { + case 16: { + #if HAVE_BIGENDIAN +- bytestream2_get_buffer(&gb, dst16, blocks * s->block_size); ++ bytestream2_get_buffer(&gb, (uint8_t*)dst16, blocks * s->block_size); + dst16 += blocks * s->block_size / 2; + #else + int samples = blocks * avctx->ch_layout.nb_channels; +diff --git a/libavcodec/vulkan_av1.c b/libavcodec/vulkan_av1.c +index 4998bf7..9730e4b 100644 +--- a/libavcodec/vulkan_av1.c ++++ b/libavcodec/vulkan_av1.c +@@ -180,7 +180,7 @@ static int vk_av1_create_params(AVCodecContext *avctx, AVBufferRef **buf) + .sType = VK_STRUCTURE_TYPE_VIDEO_SESSION_PARAMETERS_CREATE_INFO_KHR, + .pNext = &av1_params, + .videoSession = ctx->common.session, +- .videoSessionParametersTemplate = NULL, ++ .videoSessionParametersTemplate = VK_NULL_HANDLE, + }; + + err = ff_vk_decode_create_params(buf, avctx, ctx, &session_params_create); +diff --git a/libavcodec/vulkan_decode.c b/libavcodec/vulkan_decode.c +index a89d84f..fdbcbb4 100644 +--- a/libavcodec/vulkan_decode.c ++++ b/libavcodec/vulkan_decode.c +@@ -188,9 +188,9 @@ int ff_vk_decode_prepare_frame(FFVulkanDecodeContext *dec, AVFrame *pic, + return 0; + + vkpic->dpb_frame = NULL; +- vkpic->img_view_ref = NULL; +- vkpic->img_view_out = NULL; +- vkpic->img_view_dest = NULL; ++ vkpic->img_view_ref = VK_NULL_HANDLE; ++ vkpic->img_view_out = VK_NULL_HANDLE; ++ vkpic->img_view_dest = VK_NULL_HANDLE; + + vkpic->destroy_image_view = vk->DestroyImageView; + vkpic->wait_semaphores = vk->WaitSemaphores; +diff --git a/libavcodec/vulkan_video.c b/libavcodec/vulkan_video.c +index 236aa12..c5144bd 100644 +--- a/libavcodec/vulkan_video.c ++++ b/libavcodec/vulkan_video.c +@@ -287,7 +287,7 @@ av_cold void ff_vk_video_common_uninit(FFVulkanContext *s, + if (common->session) { + vk->DestroyVideoSessionKHR(s->hwctx->act_dev, common->session, + s->hwctx->alloc); +- common->session = NULL; ++ common->session = VK_NULL_HANDLE; + } + + if (common->nb_mem && common->mem) +diff --git a/libavfilter/vsrc_testsrc_vulkan.c b/libavfilter/vsrc_testsrc_vulkan.c +index 8761c21..1720bfa 100644 +--- a/libavfilter/vsrc_testsrc_vulkan.c ++++ b/libavfilter/vsrc_testsrc_vulkan.c +@@ -231,7 +231,7 @@ static int testsrc_vulkan_activate(AVFilterContext *ctx) + return AVERROR(ENOMEM); + + err = ff_vk_filter_process_simple(&s->vkctx, &s->e, &s->pl, s->picref, NULL, +- NULL, &s->opts, sizeof(s->opts)); ++ VK_NULL_HANDLE, &s->opts, sizeof(s->opts)); + if (err < 0) + return err; + } +@@ -250,7 +250,7 @@ static int testsrc_vulkan_activate(AVFilterContext *ctx) + frame->sample_aspect_ratio = s->sar; + if (!s->draw_once) { + err = ff_vk_filter_process_simple(&s->vkctx, &s->e, &s->pl, frame, NULL, +- NULL, &s->opts, sizeof(s->opts)); ++ VK_NULL_HANDLE, &s->opts, sizeof(s->opts)); + if (err < 0) { + av_frame_free(&frame); + return err; +diff --git a/libavutil/hwcontext_vaapi.c b/libavutil/hwcontext_vaapi.c +index 12bc951..d326ad6 100644 +--- a/libavutil/hwcontext_vaapi.c ++++ b/libavutil/hwcontext_vaapi.c +@@ -1203,7 +1203,7 @@ static int vaapi_map_from_drm(AVHWFramesContext *src_fc, AVFrame *dst, + + if (!use_prime2 || vas != VA_STATUS_SUCCESS) { + int k; +- unsigned long buffer_handle; ++ size_t buffer_handle; + VASurfaceAttribExternalBuffers buffer_desc; + VASurfaceAttrib buffer_attrs[2] = { + { +-- +2.43.0 + diff --git a/ffmpeg.spec b/ffmpeg.spec index 49adee5..92f6380 100644 --- a/ffmpeg.spec +++ b/ffmpeg.spec @@ -120,6 +120,8 @@ Patch2: ffmpeg-allow-fdk-aac-free.patch # https://patchwork.ffmpeg.org/project/ffmpeg/list/?series=10211 Patch4: 0001-lavc-libopenh264-Drop-openh264-runtime-version-check.patch Patch5: ffmpeg-c99.patch +# Fix build with gcc14 (-Wint-conversion, -Wincompatible-pointer-types) +Patch6: ffmpeg-gcc14.patch # Set up dlopen for openh264 Patch1001: ffmpeg-dlopen-openh264.patch From 45f69ccd8a92177fba1893ed9d054fc83b1a8ffd Mon Sep 17 00:00:00 2001 From: Pete Walter Date: Wed, 7 Feb 2024 22:50:24 +0000 Subject: [PATCH 35/95] Rebuild for libvpx 1.14.x --- ffmpeg.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ffmpeg.spec b/ffmpeg.spec index 92f6380..1cb8988 100644 --- a/ffmpeg.spec +++ b/ffmpeg.spec @@ -92,7 +92,7 @@ Name: ffmpeg %global pkg_name %{name}%{?pkg_suffix} Version: 6.1.1 -Release: 7%{?dist} +Release: 8%{?dist} Summary: A complete solution to record, convert and stream audio and video License: GPL-3.0-or-later URL: https://ffmpeg.org/ @@ -863,6 +863,9 @@ rm -rf %{buildroot}%{_datadir}/%{name}/examples %{_mandir}/man3/libswscale.3* %changelog +* Wed Feb 07 2024 Pete Walter - 6.1.1-8 +- Rebuild for libvpx 1.14.x + * Sun Jan 28 2024 Sandro Mani - 6.1.1-7 - Rebuild (tesseract) From 46131eefb0f7aeeb3d6b9e1900ba64b8e2f2b204 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20M=2E=20Basto?= Date: Wed, 14 Feb 2024 02:40:14 +0000 Subject: [PATCH 36/95] Rebuild for jpegxl (libjxl) 0.9.2 with soname bump --- ffmpeg.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ffmpeg.spec b/ffmpeg.spec index 1cb8988..f8d5447 100644 --- a/ffmpeg.spec +++ b/ffmpeg.spec @@ -92,7 +92,7 @@ Name: ffmpeg %global pkg_name %{name}%{?pkg_suffix} Version: 6.1.1 -Release: 8%{?dist} +Release: 9%{?dist} Summary: A complete solution to record, convert and stream audio and video License: GPL-3.0-or-later URL: https://ffmpeg.org/ @@ -863,6 +863,9 @@ rm -rf %{buildroot}%{_datadir}/%{name}/examples %{_mandir}/man3/libswscale.3* %changelog +* Wed Feb 14 2024 Sérgio Basto - 6.1.1-9 +- Rebuild for jpegxl (libjxl) 0.9.2 with soname bump + * Wed Feb 07 2024 Pete Walter - 6.1.1-8 - Rebuild for libvpx 1.14.x From a4fcaad3a2f2afcb4c57ea279f0c98f59a4d9c6c Mon Sep 17 00:00:00 2001 From: Dominik 'Rathann' Mierzejewski Date: Tue, 12 Mar 2024 23:35:22 +0100 Subject: [PATCH 37/95] Enable drawtext filter (requires libharfbuzz) --- ffmpeg.spec | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ffmpeg.spec b/ffmpeg.spec index f8d5447..08cce8b 100644 --- a/ffmpeg.spec +++ b/ffmpeg.spec @@ -92,7 +92,7 @@ Name: ffmpeg %global pkg_name %{name}%{?pkg_suffix} Version: 6.1.1 -Release: 9%{?dist} +Release: 10%{?dist} Summary: A complete solution to record, convert and stream audio and video License: GPL-3.0-or-later URL: https://ffmpeg.org/ @@ -175,6 +175,7 @@ BuildRequires: pkgconfig(frei0r) BuildRequires: pkgconfig(fribidi) BuildRequires: pkgconfig(gl) BuildRequires: pkgconfig(gnutls) +BuildRequires: pkgconfig(harfbuzz) BuildRequires: pkgconfig(libilbc) BuildRequires: pkgconfig(jack) %if %{with lcms2} @@ -616,6 +617,7 @@ cp -a doc/examples/{*.c,Makefile,README} _doc/examples/ --enable-libfontconfig \ --enable-libfreetype \ --enable-libfribidi \ + --enable-libharfbuzz \ --enable-libgme \ --enable-libgsm \ %if %{with dc1394} @@ -863,6 +865,9 @@ rm -rf %{buildroot}%{_datadir}/%{name}/examples %{_mandir}/man3/libswscale.3* %changelog +* Tue Mar 12 2024 Dominik Mierzejewski - 6.1.1-10 +- Enable drawtext filter (requires libharfbuzz) + * Wed Feb 14 2024 Sérgio Basto - 6.1.1-9 - Rebuild for jpegxl (libjxl) 0.9.2 with soname bump From 324d6a3037b43fc05b032443ddaa661d365e00cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20M=2E=20Basto?= Date: Wed, 13 Mar 2024 02:14:55 +0000 Subject: [PATCH 38/95] Rebuild for jpegxl (libjxl) 0.10.2 --- ffmpeg.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ffmpeg.spec b/ffmpeg.spec index 08cce8b..46da505 100644 --- a/ffmpeg.spec +++ b/ffmpeg.spec @@ -92,7 +92,7 @@ Name: ffmpeg %global pkg_name %{name}%{?pkg_suffix} Version: 6.1.1 -Release: 10%{?dist} +Release: 11%{?dist} Summary: A complete solution to record, convert and stream audio and video License: GPL-3.0-or-later URL: https://ffmpeg.org/ @@ -865,6 +865,9 @@ rm -rf %{buildroot}%{_datadir}/%{name}/examples %{_mandir}/man3/libswscale.3* %changelog +* Wed Mar 13 2024 Sérgio Basto - 6.1.1-11 +- Rebuild for jpegxl (libjxl) 0.10.2 + * Tue Mar 12 2024 Dominik Mierzejewski - 6.1.1-10 - Enable drawtext filter (requires libharfbuzz) From db2acb3681a85baed6bbc897cdac792d4b7d7c5f Mon Sep 17 00:00:00 2001 From: Kalev Lember Date: Tue, 23 Apr 2024 16:52:11 +0200 Subject: [PATCH 39/95] Stop using bundled openh264 headers in F40+ and build against noopenh264 Now that we have noopenh264 stub package in Fedora, we can stop using bundled openh264 headers and build against the system package instead. --- ffmpeg.spec | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/ffmpeg.spec b/ffmpeg.spec index 46da505..e4ceace 100644 --- a/ffmpeg.spec +++ b/ffmpeg.spec @@ -36,6 +36,14 @@ %bcond_with omxil %else +# Use bundled openh264 headers on older Fedora/RHEL where the noopenh264 stub +# package is not available +%if 0%{?fedora} && 0%{?fedora} <= 39 || 0%{?rhel} && 0%{?rhel} <= 9 +%bcond_without bundled_openh264_headers +%else +%bcond_with bundled_openh264_headers +%endif + # Disable some features because RHEL 9 packages are too old %if 0%{?rhel} && 0%{?rhel} <= 9 %bcond_with flite @@ -92,7 +100,7 @@ Name: ffmpeg %global pkg_name %{name}%{?pkg_suffix} Version: 6.1.1 -Release: 11%{?dist} +Release: 12%{?dist} Summary: A complete solution to record, convert and stream audio and video License: GPL-3.0-or-later URL: https://ffmpeg.org/ @@ -219,6 +227,9 @@ BuildRequires: pkgconfig(ogg) BuildRequires: pkgconfig(openal) BuildRequires: pkgconfig(opencore-amrnb) BuildRequires: pkgconfig(OpenCL) +%if %{without bundled_openh264_headers} +BuildRequires: pkgconfig(openh264) +%endif BuildRequires: pkgconfig(opus) BuildRequires: pkgconfig(rav1e) BuildRequires: pkgconfig(rubberband) @@ -550,7 +561,7 @@ This subpackage contains the headers for FFmpeg libswscale. %{gpgverify} --keyring='%{SOURCE3}' --signature='%{SOURCE2}' --data='%{SOURCE0}' %endif -%autosetup -a1 -S git_am +%autosetup %{?with_bundled_openh264_headers:-a1} -S git_am install -m 0644 %{SOURCE20} enable_decoders install -m 0644 %{SOURCE21} enable_encoders # fix -O3 -g in host_cflags @@ -865,6 +876,9 @@ rm -rf %{buildroot}%{_datadir}/%{name}/examples %{_mandir}/man3/libswscale.3* %changelog +* Tue Apr 23 2024 Kalev Lember - 6.1.1-12 +- Stop using bundled openh264 headers in F40+ and build against noopenh264 + * Wed Mar 13 2024 Sérgio Basto - 6.1.1-11 - Rebuild for jpegxl (libjxl) 0.10.2 From 16bba3567bf3b2ab231853898ecc3cde28908845 Mon Sep 17 00:00:00 2001 From: Dominik Mierzejewski Date: Sat, 27 Apr 2024 23:03:08 +0200 Subject: [PATCH 40/95] Backport a fix to build with Vulkan headers >= 1.3.280.0 --- ffmpeg-vulkan.patch | 99 +++++++++++++++++++++++++++++++++++++++++++++ ffmpeg.spec | 3 ++ 2 files changed, 102 insertions(+) create mode 100644 ffmpeg-vulkan.patch diff --git a/ffmpeg-vulkan.patch b/ffmpeg-vulkan.patch new file mode 100644 index 0000000..18a6bf3 --- /dev/null +++ b/ffmpeg-vulkan.patch @@ -0,0 +1,99 @@ +From: Jan Ekström +Date: Wed, 14 Feb 2024 20:40:54 +0000 (+0200) +Subject: {avcodec,tests}: rename the bundled Mesa AV1 vulkan video headers +X-Git-Url: http://git.ffmpeg.org/gitweb/ffmpeg.git/commitdiff_plain/fef22c87ada4517441701e6e61e062c9f4399c8e + +{avcodec,tests}: rename the bundled Mesa AV1 vulkan video headers + +This together with adjusting the inclusion define allows for the +build to not fail with latest Vulkan-Headers that contain the +stabilized Vulkan AV1 decoding definitions. + +Compilation fails currently as the AV1 header is getting included +via hwcontext_vulkan.h -> -> vulkan_core.h, which +finally includes vk_video/vulkan_video_codec_av1std.h and the decode +header, leading to the bundled header to never defining anything +due to the inclusion define being the same. + +This fix is imperfect, as it leads to additional re-definition +warnings for things such as +VK_STD_VULKAN_VIDEO_CODEC_AV1_DECODE_SPEC_VERSION. , but it is +not clear how to otherwise have the bundled version trump the +actually standardized one for a short-term compilation fix. + +(cherry picked from commit e06ce6d2b45edac4a2df04f304e18d4727417d24) +--- + +diff --git a/libavcodec/Makefile b/libavcodec/Makefile +index ec57e53e30..eb25707ef5 100644 +--- a/libavcodec/Makefile ++++ b/libavcodec/Makefile +@@ -1284,7 +1284,7 @@ SKIPHEADERS += %_tablegen.h \ + aacenc_quantization.h \ + aacenc_quantization_misc.h \ + bitstream_template.h \ +- vulkan_video_codec_av1std.h \ ++ vulkan_video_codec_av1std_mesa.h \ + $(ARCH)/vpx_arith.h \ + + SKIPHEADERS-$(CONFIG_AMF) += amfenc.h +@@ -1306,7 +1306,7 @@ SKIPHEADERS-$(CONFIG_XVMC) += xvmc.h + SKIPHEADERS-$(CONFIG_VAAPI) += vaapi_decode.h vaapi_hevc.h vaapi_encode.h + SKIPHEADERS-$(CONFIG_VDPAU) += vdpau.h vdpau_internal.h + SKIPHEADERS-$(CONFIG_VIDEOTOOLBOX) += videotoolbox.h vt_internal.h +-SKIPHEADERS-$(CONFIG_VULKAN) += vulkan.h vulkan_video.h vulkan_decode.h vulkan_video_codec_av1std_decode.h ++SKIPHEADERS-$(CONFIG_VULKAN) += vulkan.h vulkan_video.h vulkan_decode.h vulkan_video_codec_av1std_decode_mesa.h + SKIPHEADERS-$(CONFIG_V4L2_M2M) += v4l2_buffers.h v4l2_context.h v4l2_m2m.h + SKIPHEADERS-$(CONFIG_ZLIB) += zlib_wrapper.h + +diff --git a/libavcodec/vulkan_video.h b/libavcodec/vulkan_video.h +index b28e3fe0bd..51f44dd543 100644 +--- a/libavcodec/vulkan_video.h ++++ b/libavcodec/vulkan_video.h +@@ -23,8 +23,8 @@ + #include "vulkan.h" + + #include +-#include "vulkan_video_codec_av1std.h" +-#include "vulkan_video_codec_av1std_decode.h" ++#include "vulkan_video_codec_av1std_mesa.h" ++#include "vulkan_video_codec_av1std_decode_mesa.h" + + #define CODEC_VER_MAJ(ver) (ver >> 22) + #define CODEC_VER_MIN(ver) ((ver >> 12) & ((1 << 10) - 1)) +diff --git a/libavcodec/vulkan_video_codec_av1std_decode.h b/libavcodec/vulkan_video_codec_av1std_decode_mesa.h +similarity index 89% +rename from libavcodec/vulkan_video_codec_av1std_decode.h +rename to libavcodec/vulkan_video_codec_av1std_decode_mesa.h +index a697c00593..e2f37b4e6e 100644 +--- a/libavcodec/vulkan_video_codec_av1std_decode.h ++++ b/libavcodec/vulkan_video_codec_av1std_decode_mesa.h +@@ -14,8 +14,8 @@ + * limitations under the License. + */ + +-#ifndef VULKAN_VIDEO_CODEC_AV1STD_DECODE_H_ +-#define VULKAN_VIDEO_CODEC_AV1STD_DECODE_H_ 1 ++#ifndef VULKAN_VIDEO_CODEC_AV1STD_DECODE_MESA_H_ ++#define VULKAN_VIDEO_CODEC_AV1STD_DECODE_MESA_H_ 1 + + /* + ** This header is NOT YET generated from the Khronos Vulkan XML API Registry. +diff --git a/libavcodec/vulkan_video_codec_av1std.h b/libavcodec/vulkan_video_codec_av1std_mesa.h +similarity index 99% +rename from libavcodec/vulkan_video_codec_av1std.h +rename to libavcodec/vulkan_video_codec_av1std_mesa.h +index c46236c457..c91589eee2 100644 +--- a/libavcodec/vulkan_video_codec_av1std.h ++++ b/libavcodec/vulkan_video_codec_av1std_mesa.h +@@ -14,8 +14,8 @@ + * limitations under the License. + */ + +-#ifndef VULKAN_VIDEO_CODEC_AV1STD_H_ +-#define VULKAN_VIDEO_CODEC_AV1STD_H_ 1 ++#ifndef VULKAN_VIDEO_CODEC_AV1STD_MESA_H_ ++#define VULKAN_VIDEO_CODEC_AV1STD_MESA_H_ 1 + + /* + ** This header is NOT YET generated from the Khronos Vulkan XML API Registry. diff --git a/ffmpeg.spec b/ffmpeg.spec index e4ceace..dab0f97 100644 --- a/ffmpeg.spec +++ b/ffmpeg.spec @@ -130,6 +130,8 @@ Patch4: 0001-lavc-libopenh264-Drop-openh264-runtime-version-check.patch Patch5: ffmpeg-c99.patch # Fix build with gcc14 (-Wint-conversion, -Wincompatible-pointer-types) Patch6: ffmpeg-gcc14.patch +# Fix build with Vulkan headers >= 1.3.280.0 +Patch7: ffmpeg-vulkan.patch # Set up dlopen for openh264 Patch1001: ffmpeg-dlopen-openh264.patch @@ -878,6 +880,7 @@ rm -rf %{buildroot}%{_datadir}/%{name}/examples %changelog * Tue Apr 23 2024 Kalev Lember - 6.1.1-12 - Stop using bundled openh264 headers in F40+ and build against noopenh264 +- Backport a fix to build with Vulkan headers >= 1.3.280.0 * Wed Mar 13 2024 Sérgio Basto - 6.1.1-11 - Rebuild for jpegxl (libjxl) 0.10.2 From 16078d1d91a4ef0436f6821455e91b8ec6302902 Mon Sep 17 00:00:00 2001 From: Simone Caronni Date: Wed, 22 May 2024 09:20:16 +0200 Subject: [PATCH 41/95] Rebuild for updated VapourSynth --- ffmpeg.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ffmpeg.spec b/ffmpeg.spec index dab0f97..bb6768a 100644 --- a/ffmpeg.spec +++ b/ffmpeg.spec @@ -100,7 +100,7 @@ Name: ffmpeg %global pkg_name %{name}%{?pkg_suffix} Version: 6.1.1 -Release: 12%{?dist} +Release: 13%{?dist} Summary: A complete solution to record, convert and stream audio and video License: GPL-3.0-or-later URL: https://ffmpeg.org/ @@ -878,6 +878,9 @@ rm -rf %{buildroot}%{_datadir}/%{name}/examples %{_mandir}/man3/libswscale.3* %changelog +* Wed May 22 2024 Simone Caronni - 6.1.1-13 +- Rebuild for updated VapourSynth. + * Tue Apr 23 2024 Kalev Lember - 6.1.1-12 - Stop using bundled openh264 headers in F40+ and build against noopenh264 - Backport a fix to build with Vulkan headers >= 1.3.280.0 From 175f57600b474ed4c35b99258f454a7ea97f5a82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert-Andr=C3=A9=20Mauchin?= Date: Wed, 29 May 2024 18:34:36 +0200 Subject: [PATCH 42/95] Rebuild for svt-av1 2.1.0 From 55ef1c245cee389f8849cab31b0d0af418a0e76f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert-Andr=C3=A9=20Mauchin?= Date: Wed, 29 May 2024 18:38:55 +0200 Subject: [PATCH 43/95] Rebuild for svt-av1 2.1.0 --- ffmpeg.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ffmpeg.spec b/ffmpeg.spec index bb6768a..a48d1e3 100644 --- a/ffmpeg.spec +++ b/ffmpeg.spec @@ -100,7 +100,7 @@ Name: ffmpeg %global pkg_name %{name}%{?pkg_suffix} Version: 6.1.1 -Release: 13%{?dist} +Release: 14%{?dist} Summary: A complete solution to record, convert and stream audio and video License: GPL-3.0-or-later URL: https://ffmpeg.org/ @@ -878,6 +878,9 @@ rm -rf %{buildroot}%{_datadir}/%{name}/examples %{_mandir}/man3/libswscale.3* %changelog +* Wed May 29 2024 Robert-André Mauchin - 6.1.1-14 +- Rebuild for svt-av1 2.1.0 + * Wed May 22 2024 Simone Caronni - 6.1.1-13 - Rebuild for updated VapourSynth. From fe4d7dd25835264ceb233427d78547ba1b81f6c4 Mon Sep 17 00:00:00 2001 From: Sandro Mani Date: Thu, 13 Jun 2024 22:38:43 +0200 Subject: [PATCH 44/95] Rebuild for tesseract-5.4.1 --- ffmpeg.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ffmpeg.spec b/ffmpeg.spec index a48d1e3..b1173ab 100644 --- a/ffmpeg.spec +++ b/ffmpeg.spec @@ -100,7 +100,7 @@ Name: ffmpeg %global pkg_name %{name}%{?pkg_suffix} Version: 6.1.1 -Release: 14%{?dist} +Release: 15%{?dist} Summary: A complete solution to record, convert and stream audio and video License: GPL-3.0-or-later URL: https://ffmpeg.org/ @@ -878,6 +878,9 @@ rm -rf %{buildroot}%{_datadir}/%{name}/examples %{_mandir}/man3/libswscale.3* %changelog +* Thu Jun 13 2024 Sandro Mani - 6.1.1-15 +- Rebuild for tesseract-5.4.1 + * Wed May 29 2024 Robert-André Mauchin - 6.1.1-14 - Rebuild for svt-av1 2.1.0 From 0179ea0006014b5e92caa0111db55938176e16af Mon Sep 17 00:00:00 2001 From: Dominik 'Rathann' Mierzejewski Date: Wed, 19 Jun 2024 19:27:20 +0200 Subject: [PATCH 45/95] Backport fix for CVE-2023-49528 --- ffmpeg-CVE-2023-49528.patch | 54 +++++++++++++++++++++++++++++++++++++ ffmpeg.spec | 7 ++++- 2 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 ffmpeg-CVE-2023-49528.patch diff --git a/ffmpeg-CVE-2023-49528.patch b/ffmpeg-CVE-2023-49528.patch new file mode 100644 index 0000000..c42275c --- /dev/null +++ b/ffmpeg-CVE-2023-49528.patch @@ -0,0 +1,54 @@ +From 2d9ed64859c9887d0504cd71dbd5b2c15e14251a Mon Sep 17 00:00:00 2001 +From: Paul B Mahol +Date: Sat, 25 Nov 2023 12:54:28 +0100 +Subject: [PATCH] avfilter/af_dialoguenhance: fix overreads + +--- + libavfilter/af_dialoguenhance.c | 17 +++++++++-------- + 1 file changed, 9 insertions(+), 8 deletions(-) + +diff --git a/libavfilter/af_dialoguenhance.c b/libavfilter/af_dialoguenhance.c +index 1762ea7cde..29c8ab10a7 100644 +--- a/libavfilter/af_dialoguenhance.c ++++ b/libavfilter/af_dialoguenhance.c +@@ -96,12 +96,12 @@ static int config_input(AVFilterLink *inlink) + if (!s->window) + return AVERROR(ENOMEM); + +- s->in_frame = ff_get_audio_buffer(inlink, s->fft_size * 4); +- s->center_frame = ff_get_audio_buffer(inlink, s->fft_size * 4); +- s->out_dist_frame = ff_get_audio_buffer(inlink, s->fft_size * 4); +- s->windowed_frame = ff_get_audio_buffer(inlink, s->fft_size * 4); +- s->windowed_out = ff_get_audio_buffer(inlink, s->fft_size * 4); +- s->windowed_prev = ff_get_audio_buffer(inlink, s->fft_size * 4); ++ s->in_frame = ff_get_audio_buffer(inlink, (s->fft_size + 2) * 2); ++ s->center_frame = ff_get_audio_buffer(inlink, (s->fft_size + 2) * 2); ++ s->out_dist_frame = ff_get_audio_buffer(inlink, (s->fft_size + 2) * 2); ++ s->windowed_frame = ff_get_audio_buffer(inlink, (s->fft_size + 2) * 2); ++ s->windowed_out = ff_get_audio_buffer(inlink, (s->fft_size + 2) * 2); ++ s->windowed_prev = ff_get_audio_buffer(inlink, (s->fft_size + 2) * 2); + if (!s->in_frame || !s->windowed_out || !s->windowed_prev || + !s->out_dist_frame || !s->windowed_frame || !s->center_frame) + return AVERROR(ENOMEM); +@@ -250,6 +250,7 @@ static int de_stereo(AVFilterContext *ctx, AVFrame *out) + float *right_osamples = (float *)out->extended_data[1]; + float *center_osamples = (float *)out->extended_data[2]; + const int offset = s->fft_size - s->overlap; ++ const int nb_samples = FFMIN(s->overlap, s->in->nb_samples); + float vad; + + // shift in/out buffers +@@ -258,8 +259,8 @@ static int de_stereo(AVFilterContext *ctx, AVFrame *out) + memmove(left_out, &left_out[s->overlap], offset * sizeof(float)); + memmove(right_out, &right_out[s->overlap], offset * sizeof(float)); + +- memcpy(&left_in[offset], left_samples, s->overlap * sizeof(float)); +- memcpy(&right_in[offset], right_samples, s->overlap * sizeof(float)); ++ memcpy(&left_in[offset], left_samples, nb_samples * sizeof(float)); ++ memcpy(&right_in[offset], right_samples, nb_samples * sizeof(float)); + memset(&left_out[offset], 0, s->overlap * sizeof(float)); + memset(&right_out[offset], 0, s->overlap * sizeof(float)); + +-- +2.25.1 + diff --git a/ffmpeg.spec b/ffmpeg.spec index b1173ab..26f389c 100644 --- a/ffmpeg.spec +++ b/ffmpeg.spec @@ -100,7 +100,7 @@ Name: ffmpeg %global pkg_name %{name}%{?pkg_suffix} Version: 6.1.1 -Release: 15%{?dist} +Release: 16%{?dist} Summary: A complete solution to record, convert and stream audio and video License: GPL-3.0-or-later URL: https://ffmpeg.org/ @@ -132,6 +132,8 @@ Patch5: ffmpeg-c99.patch Patch6: ffmpeg-gcc14.patch # Fix build with Vulkan headers >= 1.3.280.0 Patch7: ffmpeg-vulkan.patch +# Backport fix for CVE-2023-49528 +Patch8: https://git.ffmpeg.org/gitweb/ffmpeg.git/patch/2d9ed64859c9887d0504cd71dbd5b2c15e14251a#/ffmpeg-CVE-2023-49528.patch # Set up dlopen for openh264 Patch1001: ffmpeg-dlopen-openh264.patch @@ -878,6 +880,9 @@ rm -rf %{buildroot}%{_datadir}/%{name}/examples %{_mandir}/man3/libswscale.3* %changelog +* Wed Jun 19 2024 Dominik Mierzejewski - 6.1.1-16 +- Backport fix for CVE-2023-49528 + * Thu Jun 13 2024 Sandro Mani - 6.1.1-15 - Rebuild for tesseract-5.4.1 From 51db0dbaf0582b477a459b2069c4314ce0470282 Mon Sep 17 00:00:00 2001 From: Nicolas Chauvet Date: Tue, 16 Jul 2024 19:59:00 +0200 Subject: [PATCH 46/95] Rebuilt for libplacebo/vmaf --- ffmpeg.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ffmpeg.spec b/ffmpeg.spec index 26f389c..ab5e7eb 100644 --- a/ffmpeg.spec +++ b/ffmpeg.spec @@ -100,7 +100,7 @@ Name: ffmpeg %global pkg_name %{name}%{?pkg_suffix} Version: 6.1.1 -Release: 16%{?dist} +Release: 17%{?dist} Summary: A complete solution to record, convert and stream audio and video License: GPL-3.0-or-later URL: https://ffmpeg.org/ @@ -880,6 +880,9 @@ rm -rf %{buildroot}%{_datadir}/%{name}/examples %{_mandir}/man3/libswscale.3* %changelog +* Tue Jul 16 2024 Nicolas Chauvet - 6.1.1-17 +- Rebuilt for libplacebo/vmaf + * Wed Jun 19 2024 Dominik Mierzejewski - 6.1.1-16 - Backport fix for CVE-2023-49528 From 805473621e9c65d4ae6a37894303ac1c7fd68755 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Wed, 17 Jul 2024 23:04:56 +0000 Subject: [PATCH 47/95] Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild --- ffmpeg.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ffmpeg.spec b/ffmpeg.spec index ab5e7eb..b5bcd94 100644 --- a/ffmpeg.spec +++ b/ffmpeg.spec @@ -100,7 +100,7 @@ Name: ffmpeg %global pkg_name %{name}%{?pkg_suffix} Version: 6.1.1 -Release: 17%{?dist} +Release: 18%{?dist} Summary: A complete solution to record, convert and stream audio and video License: GPL-3.0-or-later URL: https://ffmpeg.org/ @@ -880,6 +880,9 @@ rm -rf %{buildroot}%{_datadir}/%{name}/examples %{_mandir}/man3/libswscale.3* %changelog +* Wed Jul 17 2024 Fedora Release Engineering - 6.1.1-18 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild + * Tue Jul 16 2024 Nicolas Chauvet - 6.1.1-17 - Rebuilt for libplacebo/vmaf From 69d06fe675bcba901ca356f8ae5346afc998a3df Mon Sep 17 00:00:00 2001 From: Neal Gompa Date: Sat, 20 Jul 2024 00:04:00 -0400 Subject: [PATCH 48/95] Backport fixes for Mesa 24.0.6+ / 21.1.4+ changes for VA-API --- ...e-Make-it-possible-to-send-multiple-.patch | 137 ++++++++++++++++++ ...void-sending-the-same-slice-buffer-m.patch | 112 ++++++++++++++ ffmpeg.spec | 8 +- 3 files changed, 256 insertions(+), 1 deletion(-) create mode 100644 0001-lavc-vaapi_decode-Make-it-possible-to-send-multiple-.patch create mode 100644 0002-lavc-vaapi_av1-Avoid-sending-the-same-slice-buffer-m.patch diff --git a/0001-lavc-vaapi_decode-Make-it-possible-to-send-multiple-.patch b/0001-lavc-vaapi_decode-Make-it-possible-to-send-multiple-.patch new file mode 100644 index 0000000..34bca43 --- /dev/null +++ b/0001-lavc-vaapi_decode-Make-it-possible-to-send-multiple-.patch @@ -0,0 +1,137 @@ +From 5176821735c397de2a108cd266a6c6759a5e0ffe Mon Sep 17 00:00:00 2001 +From: David Rosca +Date: Wed, 8 May 2024 09:11:11 +0200 +Subject: [PATCH 1/2] lavc/vaapi_decode: Make it possible to send multiple + slice params buffers + +Reviewed-by: Neal Gompa +Signed-off-by: David Rosca +Signed-off-by: Haihao Xiang +(cherry picked from commit fe9d889dcd79ea18d4dfaa39df4ddbd4c8c3b15c) + +[modified to drop h264/hevc/vc1 parts stripped in Fedora Linux] +--- + libavcodec/vaapi_av1.c | 2 +- + libavcodec/vaapi_decode.c | 3 ++- + libavcodec/vaapi_decode.h | 1 + + libavcodec/vaapi_mjpeg.c | 2 +- + libavcodec/vaapi_mpeg2.c | 2 +- + libavcodec/vaapi_mpeg4.c | 2 +- + libavcodec/vaapi_vp8.c | 2 +- + libavcodec/vaapi_vp9.c | 2 +- + 8 files changed, 9 insertions(+), 7 deletions(-) + +diff --git a/libavcodec/vaapi_av1.c b/libavcodec/vaapi_av1.c +index 1f9a6071ba..03771dd3e0 100644 +--- a/libavcodec/vaapi_av1.c ++++ b/libavcodec/vaapi_av1.c +@@ -409,7 +409,7 @@ static int vaapi_av1_decode_slice(AVCodecContext *avctx, + .tg_end = s->tg_end, + }; + +- err = ff_vaapi_decode_make_slice_buffer(avctx, pic, &slice_param, ++ err = ff_vaapi_decode_make_slice_buffer(avctx, pic, &slice_param, 1, + sizeof(VASliceParameterBufferAV1), + buffer, + size); +diff --git a/libavcodec/vaapi_decode.c b/libavcodec/vaapi_decode.c +index ceac769c52..9344c21fd2 100644 +--- a/libavcodec/vaapi_decode.c ++++ b/libavcodec/vaapi_decode.c +@@ -62,6 +62,7 @@ int ff_vaapi_decode_make_param_buffer(AVCodecContext *avctx, + int ff_vaapi_decode_make_slice_buffer(AVCodecContext *avctx, + VAAPIDecodePicture *pic, + const void *params_data, ++ int nb_params, + size_t params_size, + const void *slice_data, + size_t slice_size) +@@ -90,7 +91,7 @@ int ff_vaapi_decode_make_slice_buffer(AVCodecContext *avctx, + + vas = vaCreateBuffer(ctx->hwctx->display, ctx->va_context, + VASliceParameterBufferType, +- params_size, 1, (void*)params_data, ++ params_size, nb_params, (void*)params_data, + &pic->slice_buffers[index]); + if (vas != VA_STATUS_SUCCESS) { + av_log(avctx, AV_LOG_ERROR, "Failed to create slice " +diff --git a/libavcodec/vaapi_decode.h b/libavcodec/vaapi_decode.h +index 6beda14e52..702171e108 100644 +--- a/libavcodec/vaapi_decode.h ++++ b/libavcodec/vaapi_decode.h +@@ -73,6 +73,7 @@ int ff_vaapi_decode_make_param_buffer(AVCodecContext *avctx, + int ff_vaapi_decode_make_slice_buffer(AVCodecContext *avctx, + VAAPIDecodePicture *pic, + const void *params_data, ++ int nb_params, + size_t params_size, + const void *slice_data, + size_t slice_size); +diff --git a/libavcodec/vaapi_mjpeg.c b/libavcodec/vaapi_mjpeg.c +index 5b8d47bb2a..9557cf5f9b 100644 +--- a/libavcodec/vaapi_mjpeg.c ++++ b/libavcodec/vaapi_mjpeg.c +@@ -131,7 +131,7 @@ static int vaapi_mjpeg_decode_slice(AVCodecContext *avctx, + sp.components[i].ac_table_selector = s->ac_index[i]; + } + +- err = ff_vaapi_decode_make_slice_buffer(avctx, pic, &sp, sizeof(sp), buffer, size); ++ err = ff_vaapi_decode_make_slice_buffer(avctx, pic, &sp, 1, sizeof(sp), buffer, size); + if (err) + goto fail; + +diff --git a/libavcodec/vaapi_mpeg2.c b/libavcodec/vaapi_mpeg2.c +index eeb4e87321..171a742c7f 100644 +--- a/libavcodec/vaapi_mpeg2.c ++++ b/libavcodec/vaapi_mpeg2.c +@@ -162,7 +162,7 @@ static int vaapi_mpeg2_decode_slice(AVCodecContext *avctx, const uint8_t *buffer + }; + + err = ff_vaapi_decode_make_slice_buffer(avctx, pic, +- &slice_param, sizeof(slice_param), ++ &slice_param, 1, sizeof(slice_param), + buffer, size); + if (err < 0) { + ff_vaapi_decode_cancel(avctx, pic); +diff --git a/libavcodec/vaapi_mpeg4.c b/libavcodec/vaapi_mpeg4.c +index 363b686e42..612de10cd7 100644 +--- a/libavcodec/vaapi_mpeg4.c ++++ b/libavcodec/vaapi_mpeg4.c +@@ -169,7 +169,7 @@ static int vaapi_mpeg4_decode_slice(AVCodecContext *avctx, const uint8_t *buffer + }; + + err = ff_vaapi_decode_make_slice_buffer(avctx, pic, +- &slice_param, sizeof(slice_param), ++ &slice_param, 1, sizeof(slice_param), + buffer, size); + if (err < 0) { + ff_vaapi_decode_cancel(avctx, pic); +diff --git a/libavcodec/vaapi_vp8.c b/libavcodec/vaapi_vp8.c +index 31137a45bd..66fdde1f39 100644 +--- a/libavcodec/vaapi_vp8.c ++++ b/libavcodec/vaapi_vp8.c +@@ -209,7 +209,7 @@ static int vaapi_vp8_decode_slice(AVCodecContext *avctx, + for (i = 0; i < 8; i++) + sp.partition_size[i+1] = s->coeff_partition_size[i]; + +- err = ff_vaapi_decode_make_slice_buffer(avctx, pic, &sp, sizeof(sp), data, data_size); ++ err = ff_vaapi_decode_make_slice_buffer(avctx, pic, &sp, 1, sizeof(sp), data, data_size); + if (err) + goto fail; + +diff --git a/libavcodec/vaapi_vp9.c b/libavcodec/vaapi_vp9.c +index 9dc7d5e72b..ff11022db7 100644 +--- a/libavcodec/vaapi_vp9.c ++++ b/libavcodec/vaapi_vp9.c +@@ -158,7 +158,7 @@ static int vaapi_vp9_decode_slice(AVCodecContext *avctx, + } + + err = ff_vaapi_decode_make_slice_buffer(avctx, pic, +- &slice_param, sizeof(slice_param), ++ &slice_param, 1, sizeof(slice_param), + buffer, size); + if (err) { + ff_vaapi_decode_cancel(avctx, pic); +-- +2.45.1 + diff --git a/0002-lavc-vaapi_av1-Avoid-sending-the-same-slice-buffer-m.patch b/0002-lavc-vaapi_av1-Avoid-sending-the-same-slice-buffer-m.patch new file mode 100644 index 0000000..91d018a --- /dev/null +++ b/0002-lavc-vaapi_av1-Avoid-sending-the-same-slice-buffer-m.patch @@ -0,0 +1,112 @@ +From 1740980b070897fd147b2d1a5259c9d7957d58a8 Mon Sep 17 00:00:00 2001 +From: David Rosca +Date: Wed, 8 May 2024 09:11:13 +0200 +Subject: [PATCH 2/2] lavc/vaapi_av1: Avoid sending the same slice buffer + multiple times + +When there are multiple tiles in one slice buffer, use multiple slice +params to avoid sending the same slice buffer multiple times and thus +increasing the bitstream size the driver will need to upload to hw. + +Reviewed-by: Neal Gompa +Signed-off-by: David Rosca +Signed-off-by: Haihao Xiang +(cherry picked from commit d2d911eb9a2fc6eb8d86b3ae025a56c1a2692fba) +--- + libavcodec/vaapi_av1.c | 47 +++++++++++++++++++++++++++++------------- + 1 file changed, 33 insertions(+), 14 deletions(-) + +diff --git a/libavcodec/vaapi_av1.c b/libavcodec/vaapi_av1.c +index 03771dd3e0..ea8dd4d93d 100644 +--- a/libavcodec/vaapi_av1.c ++++ b/libavcodec/vaapi_av1.c +@@ -19,6 +19,7 @@ + */ + + #include "libavutil/frame.h" ++#include "libavutil/mem.h" + #include "hwaccel_internal.h" + #include "vaapi_decode.h" + #include "internal.h" +@@ -42,6 +43,9 @@ typedef struct VAAPIAV1DecContext { + */ + VAAPIAV1FrameRef ref_tab[AV1_NUM_REF_FRAMES]; + AVFrame *tmp_frame; ++ ++ int nb_slice_params; ++ VASliceParameterBufferAV1 *slice_params; + } VAAPIAV1DecContext; + + static VASurfaceID vaapi_av1_surface_id(AV1Frame *vf) +@@ -97,6 +101,8 @@ static int vaapi_av1_decode_uninit(AVCodecContext *avctx) + for (int i = 0; i < FF_ARRAY_ELEMS(ctx->ref_tab); i++) + av_frame_free(&ctx->ref_tab[i].frame); + ++ av_freep(&ctx->slice_params); ++ + return ff_vaapi_decode_uninit(avctx); + } + +@@ -393,13 +399,24 @@ static int vaapi_av1_decode_slice(AVCodecContext *avctx, + { + const AV1DecContext *s = avctx->priv_data; + VAAPIDecodePicture *pic = s->cur_frame.hwaccel_picture_private; +- VASliceParameterBufferAV1 slice_param; +- int err = 0; ++ VAAPIAV1DecContext *ctx = avctx->internal->hwaccel_priv_data; ++ int err, nb_params; ++ ++ nb_params = s->tg_end - s->tg_start + 1; ++ if (ctx->nb_slice_params < nb_params) { ++ ctx->slice_params = av_realloc_array(ctx->slice_params, ++ nb_params, ++ sizeof(*ctx->slice_params)); ++ if (!ctx->slice_params) { ++ ctx->nb_slice_params = 0; ++ err = AVERROR(ENOMEM); ++ goto fail; ++ } ++ ctx->nb_slice_params = nb_params; ++ } + + for (int i = s->tg_start; i <= s->tg_end; i++) { +- memset(&slice_param, 0, sizeof(VASliceParameterBufferAV1)); +- +- slice_param = (VASliceParameterBufferAV1) { ++ ctx->slice_params[i - s->tg_start] = (VASliceParameterBufferAV1) { + .slice_data_size = s->tile_group_info[i].tile_size, + .slice_data_offset = s->tile_group_info[i].tile_offset, + .slice_data_flag = VA_SLICE_DATA_FLAG_ALL, +@@ -408,18 +425,20 @@ static int vaapi_av1_decode_slice(AVCodecContext *avctx, + .tg_start = s->tg_start, + .tg_end = s->tg_end, + }; +- +- err = ff_vaapi_decode_make_slice_buffer(avctx, pic, &slice_param, 1, +- sizeof(VASliceParameterBufferAV1), +- buffer, +- size); +- if (err) { +- ff_vaapi_decode_cancel(avctx, pic); +- return err; +- } + } + ++ err = ff_vaapi_decode_make_slice_buffer(avctx, pic, ctx->slice_params, nb_params, ++ sizeof(VASliceParameterBufferAV1), ++ buffer, ++ size); ++ if (err) ++ goto fail; ++ + return 0; ++ ++fail: ++ ff_vaapi_decode_cancel(avctx, pic); ++ return err; + } + + const FFHWAccel ff_av1_vaapi_hwaccel = { +-- +2.45.1 + diff --git a/ffmpeg.spec b/ffmpeg.spec index b5bcd94..f178909 100644 --- a/ffmpeg.spec +++ b/ffmpeg.spec @@ -100,7 +100,7 @@ Name: ffmpeg %global pkg_name %{name}%{?pkg_suffix} Version: 6.1.1 -Release: 18%{?dist} +Release: 19%{?dist} Summary: A complete solution to record, convert and stream audio and video License: GPL-3.0-or-later URL: https://ffmpeg.org/ @@ -134,6 +134,9 @@ Patch6: ffmpeg-gcc14.patch Patch7: ffmpeg-vulkan.patch # Backport fix for CVE-2023-49528 Patch8: https://git.ffmpeg.org/gitweb/ffmpeg.git/patch/2d9ed64859c9887d0504cd71dbd5b2c15e14251a#/ffmpeg-CVE-2023-49528.patch +# Fixes for Mesa 24.0.6+ / 24.1.4+ VA-API +Patch9: 0001-lavc-vaapi_decode-Make-it-possible-to-send-multiple-.patch +Patch10: 0002-lavc-vaapi_av1-Avoid-sending-the-same-slice-buffer-m.patch # Set up dlopen for openh264 Patch1001: ffmpeg-dlopen-openh264.patch @@ -880,6 +883,9 @@ rm -rf %{buildroot}%{_datadir}/%{name}/examples %{_mandir}/man3/libswscale.3* %changelog +* Sat Jul 20 2024 Neal Gompa - 6.1.1-19 +- Backport fixes for Mesa 24.0.6+ / 21.1.4+ changes for VA-API + * Wed Jul 17 2024 Fedora Release Engineering - 6.1.1-18 - Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild From 2612e2ec91e40f76523de881172e52c689b0cebc Mon Sep 17 00:00:00 2001 From: Fabio Valentini Date: Sat, 24 Aug 2024 11:54:40 +0200 Subject: [PATCH 49/95] Update to 6.1.2 --- ffmpeg-vulkan.patch | 99 --------------------------------------------- ffmpeg.spec | 9 +++-- ffmpeg_free_sources | 4 +- sources | 4 +- 4 files changed, 9 insertions(+), 107 deletions(-) delete mode 100644 ffmpeg-vulkan.patch diff --git a/ffmpeg-vulkan.patch b/ffmpeg-vulkan.patch deleted file mode 100644 index 18a6bf3..0000000 --- a/ffmpeg-vulkan.patch +++ /dev/null @@ -1,99 +0,0 @@ -From: Jan Ekström -Date: Wed, 14 Feb 2024 20:40:54 +0000 (+0200) -Subject: {avcodec,tests}: rename the bundled Mesa AV1 vulkan video headers -X-Git-Url: http://git.ffmpeg.org/gitweb/ffmpeg.git/commitdiff_plain/fef22c87ada4517441701e6e61e062c9f4399c8e - -{avcodec,tests}: rename the bundled Mesa AV1 vulkan video headers - -This together with adjusting the inclusion define allows for the -build to not fail with latest Vulkan-Headers that contain the -stabilized Vulkan AV1 decoding definitions. - -Compilation fails currently as the AV1 header is getting included -via hwcontext_vulkan.h -> -> vulkan_core.h, which -finally includes vk_video/vulkan_video_codec_av1std.h and the decode -header, leading to the bundled header to never defining anything -due to the inclusion define being the same. - -This fix is imperfect, as it leads to additional re-definition -warnings for things such as -VK_STD_VULKAN_VIDEO_CODEC_AV1_DECODE_SPEC_VERSION. , but it is -not clear how to otherwise have the bundled version trump the -actually standardized one for a short-term compilation fix. - -(cherry picked from commit e06ce6d2b45edac4a2df04f304e18d4727417d24) ---- - -diff --git a/libavcodec/Makefile b/libavcodec/Makefile -index ec57e53e30..eb25707ef5 100644 ---- a/libavcodec/Makefile -+++ b/libavcodec/Makefile -@@ -1284,7 +1284,7 @@ SKIPHEADERS += %_tablegen.h \ - aacenc_quantization.h \ - aacenc_quantization_misc.h \ - bitstream_template.h \ -- vulkan_video_codec_av1std.h \ -+ vulkan_video_codec_av1std_mesa.h \ - $(ARCH)/vpx_arith.h \ - - SKIPHEADERS-$(CONFIG_AMF) += amfenc.h -@@ -1306,7 +1306,7 @@ SKIPHEADERS-$(CONFIG_XVMC) += xvmc.h - SKIPHEADERS-$(CONFIG_VAAPI) += vaapi_decode.h vaapi_hevc.h vaapi_encode.h - SKIPHEADERS-$(CONFIG_VDPAU) += vdpau.h vdpau_internal.h - SKIPHEADERS-$(CONFIG_VIDEOTOOLBOX) += videotoolbox.h vt_internal.h --SKIPHEADERS-$(CONFIG_VULKAN) += vulkan.h vulkan_video.h vulkan_decode.h vulkan_video_codec_av1std_decode.h -+SKIPHEADERS-$(CONFIG_VULKAN) += vulkan.h vulkan_video.h vulkan_decode.h vulkan_video_codec_av1std_decode_mesa.h - SKIPHEADERS-$(CONFIG_V4L2_M2M) += v4l2_buffers.h v4l2_context.h v4l2_m2m.h - SKIPHEADERS-$(CONFIG_ZLIB) += zlib_wrapper.h - -diff --git a/libavcodec/vulkan_video.h b/libavcodec/vulkan_video.h -index b28e3fe0bd..51f44dd543 100644 ---- a/libavcodec/vulkan_video.h -+++ b/libavcodec/vulkan_video.h -@@ -23,8 +23,8 @@ - #include "vulkan.h" - - #include --#include "vulkan_video_codec_av1std.h" --#include "vulkan_video_codec_av1std_decode.h" -+#include "vulkan_video_codec_av1std_mesa.h" -+#include "vulkan_video_codec_av1std_decode_mesa.h" - - #define CODEC_VER_MAJ(ver) (ver >> 22) - #define CODEC_VER_MIN(ver) ((ver >> 12) & ((1 << 10) - 1)) -diff --git a/libavcodec/vulkan_video_codec_av1std_decode.h b/libavcodec/vulkan_video_codec_av1std_decode_mesa.h -similarity index 89% -rename from libavcodec/vulkan_video_codec_av1std_decode.h -rename to libavcodec/vulkan_video_codec_av1std_decode_mesa.h -index a697c00593..e2f37b4e6e 100644 ---- a/libavcodec/vulkan_video_codec_av1std_decode.h -+++ b/libavcodec/vulkan_video_codec_av1std_decode_mesa.h -@@ -14,8 +14,8 @@ - * limitations under the License. - */ - --#ifndef VULKAN_VIDEO_CODEC_AV1STD_DECODE_H_ --#define VULKAN_VIDEO_CODEC_AV1STD_DECODE_H_ 1 -+#ifndef VULKAN_VIDEO_CODEC_AV1STD_DECODE_MESA_H_ -+#define VULKAN_VIDEO_CODEC_AV1STD_DECODE_MESA_H_ 1 - - /* - ** This header is NOT YET generated from the Khronos Vulkan XML API Registry. -diff --git a/libavcodec/vulkan_video_codec_av1std.h b/libavcodec/vulkan_video_codec_av1std_mesa.h -similarity index 99% -rename from libavcodec/vulkan_video_codec_av1std.h -rename to libavcodec/vulkan_video_codec_av1std_mesa.h -index c46236c457..c91589eee2 100644 ---- a/libavcodec/vulkan_video_codec_av1std.h -+++ b/libavcodec/vulkan_video_codec_av1std_mesa.h -@@ -14,8 +14,8 @@ - * limitations under the License. - */ - --#ifndef VULKAN_VIDEO_CODEC_AV1STD_H_ --#define VULKAN_VIDEO_CODEC_AV1STD_H_ 1 -+#ifndef VULKAN_VIDEO_CODEC_AV1STD_MESA_H_ -+#define VULKAN_VIDEO_CODEC_AV1STD_MESA_H_ 1 - - /* - ** This header is NOT YET generated from the Khronos Vulkan XML API Registry. diff --git a/ffmpeg.spec b/ffmpeg.spec index f178909..d4f39d2 100644 --- a/ffmpeg.spec +++ b/ffmpeg.spec @@ -99,8 +99,8 @@ Name: ffmpeg %global pkg_name %{name}%{?pkg_suffix} -Version: 6.1.1 -Release: 19%{?dist} +Version: 6.1.2 +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/ @@ -130,8 +130,6 @@ Patch4: 0001-lavc-libopenh264-Drop-openh264-runtime-version-check.patch Patch5: ffmpeg-c99.patch # Fix build with gcc14 (-Wint-conversion, -Wincompatible-pointer-types) Patch6: ffmpeg-gcc14.patch -# Fix build with Vulkan headers >= 1.3.280.0 -Patch7: ffmpeg-vulkan.patch # Backport fix for CVE-2023-49528 Patch8: https://git.ffmpeg.org/gitweb/ffmpeg.git/patch/2d9ed64859c9887d0504cd71dbd5b2c15e14251a#/ffmpeg-CVE-2023-49528.patch # Fixes for Mesa 24.0.6+ / 24.1.4+ VA-API @@ -883,6 +881,9 @@ rm -rf %{buildroot}%{_datadir}/%{name}/examples %{_mandir}/man3/libswscale.3* %changelog +* Sat Aug 24 2024 Fabio Valentini - 6.1.2-1 +- Update to 6.1.2 + * Sat Jul 20 2024 Neal Gompa - 6.1.1-19 - Backport fixes for Mesa 24.0.6+ / 21.1.4+ changes for VA-API diff --git a/ffmpeg_free_sources b/ffmpeg_free_sources index c3be5a0..ee8be40 100644 --- a/ffmpeg_free_sources +++ b/ffmpeg_free_sources @@ -1816,9 +1816,9 @@ libavcodec/vulkan_av1.c libavcodec/vulkan_decode.c libavcodec/vulkan_decode.h libavcodec/vulkan_video.c +libavcodec/vulkan_video_codec_av1std_decode_mesa.h +libavcodec/vulkan_video_codec_av1std_mesa.h libavcodec/vulkan_video.h -libavcodec/vulkan_video_codec_av1std.h -libavcodec/vulkan_video_codec_av1std_decode.h libavcodec/vvc.h libavcodec/vvc_mp4toannexb_bsf.c libavcodec/vvc_parser.c diff --git a/sources b/sources index f142d78..03daa05 100644 --- a/sources +++ b/sources @@ -1,4 +1,4 @@ -SHA512 (ffmpeg-free-6.1.1.tar.xz) = f7ca7901b7affa45fd6016b7ac2d7f843f89ad7f813c6f37228d184842aa55167429585e172d3da61ca1ef64818d563199faa7d06295eea1fd829696d28fa044 -SHA512 (ffmpeg-6.1.1.tar.xz.asc) = 0e10c1f560bab0812d759d286656593dea5940f02bb52d88d9ba7f10b12b9cc3d7aa2a41c5f7a45b319069e04dce22dc1286b3c1ba685b35cd6d04cd81c5a0f5 +SHA512 (ffmpeg-free-6.1.2.tar.xz) = edaa836c69b0ec2f484a4fd9b49dab97f76e7c6451449f8db8f81f04558974d850b725e3affc36f9790c206a049e42b710f54bb8fd7e4da00ec80ebce6a13e5f +SHA512 (ffmpeg-6.1.2.tar.xz.asc) = a26dba1f4870b964080b45f8468f5ce3591eb6aa69be426bf4afbe5a60c3cbd0fe5056dc86ca7bb817c04ae30d39160cb7773772a9a2123ae7f095b18a6d7050 SHA512 (ffmpeg-dlopen-headers.tar.xz) = 97e6986fc2bb9dfa4516135a76b04d27ceb52ff96f0af21a6169919aeefefb4d2e2e24a771959689cdbec385f5d71614ba661223c67c0e94089a6dd823a30099 SHA512 (ffmpeg.keyring) = 9b36506835db36f776b7ddb53ad6fa9e915e6ca2f9c7cfebe8eb45513e1036a985283590a840ca313a111bf35dc3731f68885aaafb1fb7011ec433cc119e5165 From 0c021328bab3d76894ba055e5d55393e29888bbe Mon Sep 17 00:00:00 2001 From: Neal Gompa Date: Fri, 6 Sep 2024 07:40:18 -0400 Subject: [PATCH 50/95] Rebase to 7.0.2 (rhbz#2273572) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Drop OpenH264 dlopen headers as we use noopenh264 now - Use modern bconds Co-authored-by: Robert-André Mauchin --- .gitignore | 2 + ...-Drop-openh264-runtime-version-check.patch | 109 ------ README.md | 2 +- enable_decoders | 10 +- enable_encoders | 8 +- ffmpeg-CVE-2023-49528.patch | 54 --- ffmpeg-allow-fdk-aac-free.patch | 17 +- ffmpeg-c99.patch | 67 ---- ffmpeg-chromium.patch | 18 +- ffmpeg-codec-choice.patch | 33 +- ffmpeg-dlopen-openh264.patch | 363 ------------------ ffmpeg-gcc14.patch | 131 ------- ffmpeg.spec | 138 +++---- ffmpeg_free_sources | 264 ++++++++++--- sources | 5 +- 15 files changed, 322 insertions(+), 899 deletions(-) delete mode 100644 0001-lavc-libopenh264-Drop-openh264-runtime-version-check.patch delete mode 100644 ffmpeg-CVE-2023-49528.patch delete mode 100644 ffmpeg-c99.patch delete mode 100644 ffmpeg-dlopen-openh264.patch delete mode 100644 ffmpeg-gcc14.patch diff --git a/.gitignore b/.gitignore index f0c157a..381c5ba 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,5 @@ ffmpeg-*.asc ffmpeg-*.rpm ffmpeg-*.tar.xz /ffmpeg.keyring +/results_* +/*.rpm diff --git a/0001-lavc-libopenh264-Drop-openh264-runtime-version-check.patch b/0001-lavc-libopenh264-Drop-openh264-runtime-version-check.patch deleted file mode 100644 index 7066f16..0000000 --- a/0001-lavc-libopenh264-Drop-openh264-runtime-version-check.patch +++ /dev/null @@ -1,109 +0,0 @@ -From a641e629591d68bd3edd99bddec623dc31295f6b Mon Sep 17 00:00:00 2001 -From: Kalev Lember -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 ---- - 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 - diff --git a/README.md b/README.md index 9b921a7..d42d487 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ community or a corporation. 2. Set the `Release` to 0 in the spec file. 3. Set `pkg_suffix` to `%nil` 4. Do a full build locally: `fedpkg mockbuild --with full_build` -5. Run `./ffmpeg_update_free_sources.sh results_ffmpeg/5.0/0.fc35/build.log` +5. Run `./ffmpeg_update_free_sources.sh results_ffmpeg/7.0/0.fc40/build.log` This will update the `ffmpeg_free_sources` file list. Note that header files will need to be manually added to the `ffmpeg_free_sources` file list. diff --git a/enable_decoders b/enable_decoders index ea1c38e..7b812cc 100644 --- a/enable_decoders +++ b/enable_decoders @@ -81,7 +81,6 @@ aura aura2 av1 # libaom av1_qsv # libaom -ayuv # trivial bethsoftvid # trivial bfi # trivial bink @@ -162,7 +161,7 @@ gsm_ms gsm_ms_at h261 h263 -h263_v4l2m2m +h263_v4l2m2m # hardware h263i h263p hap @@ -244,13 +243,13 @@ mp3on4 mp3on4float mpc7 mpc8 -mpeg1video mpeg1_v4l2m2m -mpeg2video +mpeg1video mpeg2_qsv mpeg2_v4l2m2m +mpeg2video mpeg4 -mpeg4_v4l2m2m +mpeg4_v4l2m2m # hardware mpegvideo mpl2 msa1 @@ -335,6 +334,7 @@ qcelp qdm2 qdmc qdraw +qoa qoi qpeg qtrle diff --git a/enable_encoders b/enable_encoders index 10dd53a..810d081 100644 --- a/enable_encoders +++ b/enable_encoders @@ -31,7 +31,6 @@ av1_amf av1_nvenc av1_qsv av1_vaapi -ayuv # trival bitpacked # trivial bmp # trivial cinepak @@ -70,9 +69,9 @@ hevc_v4l2m2m # hardware hevc_vaapi # hardware huffyuv # trivial+zlib ilbc # ilbc -jpegls jpeg2000 -libaom # libaom +jpegls +libaom libaom_av1 # libaom libcodec2 # codec2 libgsm # libgsm @@ -85,7 +84,6 @@ libopenh264 # openh264_dlopen libopenjpeg # openjpeg libopus # opus librav1e # rav1e -libschroedinger # schroedinger libspeex # speex libsvtav1 libtheora # libtheora @@ -104,9 +102,9 @@ mlp mp2 # twolame mp2fixed # twolame mpeg1video -mpeg2video mpeg2_qsv mpeg2_vaapi +mpeg2video mpeg4 mpeg4_v4l2m2m # hardware msmpeg4v2 diff --git a/ffmpeg-CVE-2023-49528.patch b/ffmpeg-CVE-2023-49528.patch deleted file mode 100644 index c42275c..0000000 --- a/ffmpeg-CVE-2023-49528.patch +++ /dev/null @@ -1,54 +0,0 @@ -From 2d9ed64859c9887d0504cd71dbd5b2c15e14251a Mon Sep 17 00:00:00 2001 -From: Paul B Mahol -Date: Sat, 25 Nov 2023 12:54:28 +0100 -Subject: [PATCH] avfilter/af_dialoguenhance: fix overreads - ---- - libavfilter/af_dialoguenhance.c | 17 +++++++++-------- - 1 file changed, 9 insertions(+), 8 deletions(-) - -diff --git a/libavfilter/af_dialoguenhance.c b/libavfilter/af_dialoguenhance.c -index 1762ea7cde..29c8ab10a7 100644 ---- a/libavfilter/af_dialoguenhance.c -+++ b/libavfilter/af_dialoguenhance.c -@@ -96,12 +96,12 @@ static int config_input(AVFilterLink *inlink) - if (!s->window) - return AVERROR(ENOMEM); - -- s->in_frame = ff_get_audio_buffer(inlink, s->fft_size * 4); -- s->center_frame = ff_get_audio_buffer(inlink, s->fft_size * 4); -- s->out_dist_frame = ff_get_audio_buffer(inlink, s->fft_size * 4); -- s->windowed_frame = ff_get_audio_buffer(inlink, s->fft_size * 4); -- s->windowed_out = ff_get_audio_buffer(inlink, s->fft_size * 4); -- s->windowed_prev = ff_get_audio_buffer(inlink, s->fft_size * 4); -+ s->in_frame = ff_get_audio_buffer(inlink, (s->fft_size + 2) * 2); -+ s->center_frame = ff_get_audio_buffer(inlink, (s->fft_size + 2) * 2); -+ s->out_dist_frame = ff_get_audio_buffer(inlink, (s->fft_size + 2) * 2); -+ s->windowed_frame = ff_get_audio_buffer(inlink, (s->fft_size + 2) * 2); -+ s->windowed_out = ff_get_audio_buffer(inlink, (s->fft_size + 2) * 2); -+ s->windowed_prev = ff_get_audio_buffer(inlink, (s->fft_size + 2) * 2); - if (!s->in_frame || !s->windowed_out || !s->windowed_prev || - !s->out_dist_frame || !s->windowed_frame || !s->center_frame) - return AVERROR(ENOMEM); -@@ -250,6 +250,7 @@ static int de_stereo(AVFilterContext *ctx, AVFrame *out) - float *right_osamples = (float *)out->extended_data[1]; - float *center_osamples = (float *)out->extended_data[2]; - const int offset = s->fft_size - s->overlap; -+ const int nb_samples = FFMIN(s->overlap, s->in->nb_samples); - float vad; - - // shift in/out buffers -@@ -258,8 +259,8 @@ static int de_stereo(AVFilterContext *ctx, AVFrame *out) - memmove(left_out, &left_out[s->overlap], offset * sizeof(float)); - memmove(right_out, &right_out[s->overlap], offset * sizeof(float)); - -- memcpy(&left_in[offset], left_samples, s->overlap * sizeof(float)); -- memcpy(&right_in[offset], right_samples, s->overlap * sizeof(float)); -+ memcpy(&left_in[offset], left_samples, nb_samples * sizeof(float)); -+ memcpy(&right_in[offset], right_samples, nb_samples * sizeof(float)); - memset(&left_out[offset], 0, s->overlap * sizeof(float)); - memset(&right_out[offset], 0, s->overlap * sizeof(float)); - --- -2.25.1 - diff --git a/ffmpeg-allow-fdk-aac-free.patch b/ffmpeg-allow-fdk-aac-free.patch index 3b87cce..11e1a3c 100644 --- a/ffmpeg-allow-fdk-aac-free.patch +++ b/ffmpeg-allow-fdk-aac-free.patch @@ -4,23 +4,24 @@ fdk-aac-free-devel is GPL compatible See https://bugzilla.redhat.com/show_bug.cgi?id=1501522#c112 -Index: ffmpeg-5.0/configure +Index: ffmpeg-7.0/configure =================================================================== ---- ffmpeg-5.0.orig/configure 2022-02-09 20:07:49.490888877 +0100 -+++ ffmpeg-5.0/configure 2022-02-09 20:08:30.102854308 +0100 -@@ -1783,7 +1783,6 @@ EXTERNAL_LIBRARY_GPL_LIST=" - +--- ffmpeg-7.0.orig/configure 2022-02-09 20:07:49.490888877 +0100 ++++ ffmpeg-7.0/configure 2022-02-09 20:08:30.102854308 +0100 +@@ -1872,7 +1872,6 @@ EXTERNAL_LIBRARY_GPL_LIST=" + EXTERNAL_LIBRARY_NONFREE_LIST=" decklink - libfdk_aac libtls " - -@@ -1822,6 +1821,7 @@ EXTERNAL_LIBRARY_LIST=" + +@@ -1912,6 +1911,7 @@ EXTERNAL_LIBRARY_LIST=" + libcodec2 libdav1d libdc1394 - libdrm + libfdk_aac libflite libfontconfig libfreetype + diff --git a/ffmpeg-c99.patch b/ffmpeg-c99.patch deleted file mode 100644 index 0ae4d8a..0000000 --- a/ffmpeg-c99.patch +++ /dev/null @@ -1,67 +0,0 @@ -From 42982b5a5d461530a792e69b3e8abdd9d6d67052 Mon Sep 17 00:00:00 2001 -From: Frank Plowman -Date: Fri, 22 Dec 2023 12:00:01 +0000 -Subject: [PATCH] avformat/ffrtmpcrypt: Fix int-conversion warning -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit -Content-type: text/plain - -The gcrypt definition of `bn_new` used to use the return statement -on errors, with an AVERROR return value, regardless of the signature -of the function where the macro is used - it is called in -`dh_generate_key` and `ff_dh_init` which return pointers. As a result, -compiling with gcrypt and the ffrtmpcrypt protocol resulted in an -int-conversion warning. GCC 14 may upgrade these to errors [1]. - -This patch fixes the problem by changing the macro to remove `AVERROR` -and instead set `bn` to null if the allocation fails. This is the -behaviour of all the other `bn_new` implementations and so the result is -already checked at all the callsites. AFAICT, this should be the only -change needed to get ffmpeg off Fedora's naughty list of projects with -warnings which may be upgraded to errors in GCC 14 [2]. - -[1]: https://gcc.gnu.org/pipermail/gcc/2023-May/241264.html -[2]: https://www.mail-archive.com/devel@lists.fedoraproject.org/msg196024.html - -Signed-off-by: Frank Plowman -Signed-off-by: Martin Storsjö ---- - libavformat/rtmpdh.c | 21 ++++++++++++--------- - 1 file changed, 12 insertions(+), 9 deletions(-) - -diff --git a/libavformat/rtmpdh.c b/libavformat/rtmpdh.c -index 5ddae537a1..6a6c2ccd87 100644 ---- a/libavformat/rtmpdh.c -+++ b/libavformat/rtmpdh.c -@@ -113,15 +113,18 @@ static int bn_modexp(FFBigNum bn, FFBigNum y, FFBigNum q, FFBigNum p) - return 0; - } - #elif CONFIG_GCRYPT --#define bn_new(bn) \ -- do { \ -- if (!gcry_control(GCRYCTL_INITIALIZATION_FINISHED_P)) { \ -- if (!gcry_check_version("1.5.4")) \ -- return AVERROR(EINVAL); \ -- gcry_control(GCRYCTL_DISABLE_SECMEM, 0); \ -- gcry_control(GCRYCTL_INITIALIZATION_FINISHED, 0); \ -- } \ -- bn = gcry_mpi_new(1); \ -+#define bn_new(bn) \ -+ do { \ -+ if (!gcry_control(GCRYCTL_INITIALIZATION_FINISHED_P)) { \ -+ if (gcry_check_version("1.5.4")) { \ -+ gcry_control(GCRYCTL_DISABLE_SECMEM, 0); \ -+ gcry_control(GCRYCTL_INITIALIZATION_FINISHED, 0); \ -+ } \ -+ } \ -+ if (gcry_control(GCRYCTL_INITIALIZATION_FINISHED_P)) \ -+ bn = gcry_mpi_new(1); \ -+ else \ -+ bn = NULL; \ - } while (0) - #define bn_free(bn) gcry_mpi_release(bn) - #define bn_set_word(bn, w) gcry_mpi_set_ui(bn, w) --- -2.43.0 - diff --git a/ffmpeg-chromium.patch b/ffmpeg-chromium.patch index 2160609..2f5877c 100644 --- a/ffmpeg-chromium.patch +++ b/ffmpeg-chromium.patch @@ -12,35 +12,35 @@ 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 - +@@ -1170,6 +1170,10 @@ typedef struct AVStreamGroup { + + struct AVCodecParserContext *av_stream_get_parser(const AVStream *s); + +// 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) +@@ -56,6 +56,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; ++ 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-codec-choice.patch b/ffmpeg-codec-choice.patch index 221b4f6..f6a4ead 100644 --- a/ffmpeg-codec-choice.patch +++ b/ffmpeg-codec-choice.patch @@ -11,19 +11,19 @@ reduced codec selection list. libavformat/matroskaenc.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) -Index: ffmpeg-6.0/libavformat/matroskaenc.c +Index: ffmpeg-7.0/libavformat/matroskaenc.c =================================================================== ---- ffmpeg-6.0.orig/libavformat/matroskaenc.c -+++ ffmpeg-6.0/libavformat/matroskaenc.c -@@ -3321,16 +3321,25 @@ static int mkv_query_codec(enum AVCodecI +--- ffmpeg-7.0.orig/libavformat/matroskaenc.c ++++ ffmpeg-7.0/libavformat/matroskaenc.c +@@ -3540,16 +3540,25 @@ static int mkv_query_codec(enum AVCodecI return 0; } - + +#define PREFAUDIO \ -+ CONFIG_LIBOPUS_ENCODER ? AV_CODEC_ID_OPUS : \ -+ CONFIG_AAC_ENCODER ? AV_CODEC_ID_AAC : \ -+ CONFIG_VORBIS_ENCODER ? AV_CODEC_ID_VORBIS : \ -+ AV_CODEC_ID_AC3 ++ CONFIG_LIBOPUS_ENCODER ? AV_CODEC_ID_OPUS : \ ++ CONFIG_AAC_ENCODER ? AV_CODEC_ID_AAC : \ ++ CONFIG_VORBIS_ENCODER ? AV_CODEC_ID_VORBIS : \ ++ AV_CODEC_ID_AC3 + const FFOutputFormat ff_matroska_muxer = { .p.name = "matroska", @@ -36,16 +36,16 @@ Index: ffmpeg-6.0/libavformat/matroskaenc.c - .p.video_codec = CONFIG_LIBX264_ENCODER ? - AV_CODEC_ID_H264 : AV_CODEC_ID_MPEG4, + .p.audio_codec = PREFAUDIO, -+ .p.video_codec = -+ CONFIG_LIBVPX_VP9_ENCODER ? AV_CODEC_ID_VP9 : \ -+ CONFIG_LIBX264_ENCODER ? AV_CODEC_ID_H264 : \ -+ CONFIG_LIBVPX_VP8_ENCODER ? AV_CODEC_ID_VP8 : \ -+ CONFIG_MPEG4_ENCODER ? AV_CODEC_ID_MPEG4 : \ -+ AV_CODEC_ID_THEORA, ++ .p.video_codec = ++ CONFIG_LIBVPX_VP9_ENCODER ? AV_CODEC_ID_VP9 : \ ++ CONFIG_LIBX264_ENCODER ? AV_CODEC_ID_H264 : \ ++ CONFIG_LIBVPX_VP8_ENCODER ? AV_CODEC_ID_VP8 : \ ++ CONFIG_MPEG4_ENCODER ? AV_CODEC_ID_MPEG4 : \ ++ AV_CODEC_ID_THEORA, .init = mkv_init, .deinit = mkv_deinit, .write_header = mkv_write_header, -@@ -3388,8 +3397,7 @@ const FFOutputFormat ff_matroska_audio_m +@@ -3617,8 +3626,7 @@ const FFOutputFormat ff_matroska_audio_m .p.mime_type = "audio/x-matroska", .p.extensions = "mka", .priv_data_size = sizeof(MatroskaMuxContext), @@ -55,3 +55,4 @@ Index: ffmpeg-6.0/libavformat/matroskaenc.c .p.video_codec = AV_CODEC_ID_NONE, .init = mkv_init, .deinit = mkv_deinit, + diff --git a/ffmpeg-dlopen-openh264.patch b/ffmpeg-dlopen-openh264.patch deleted file mode 100644 index 329606b..0000000 --- a/ffmpeg-dlopen-openh264.patch +++ /dev/null @@ -1,363 +0,0 @@ -From 3daa49cae0bfc3de434dd28c3a23ae877f0639db Mon Sep 17 00:00:00 2001 -From: Neal Gompa -Date: Thu, 4 Jan 2024 10:21:17 -0500 -Subject: [PATCH] lavc/openh264: Add the ability to dlopen() OpenH264 - -We can't directly depend on OpenH264, but we can weakly link to it -and gracefully expose the capability. - -Co-authored-by: Andreas Schneider -Co-authored-by: Neal Gompa - -Signed-off-by: Andreas Schneider -Signed-off-by: Neal Gompa ---- - configure | 3 + - libavcodec/Makefile | 1 + - 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, 234 insertions(+) - create mode 100644 libavcodec/libopenh264_dlopen.c - create mode 100644 libavcodec/libopenh264_dlopen.h - -diff --git a/configure b/configure -index 1f0b9497cb..97fa4a5d6a 100755 ---- a/configure -+++ b/configure -@@ -249,6 +249,7 @@ External library support: - --enable-libopencore-amrwb enable AMR-WB decoding via libopencore-amrwb [no] - --enable-libopencv enable video filtering via libopencv [no] - --enable-libopenh264 enable H.264 encoding via OpenH264 [no] -+ --enable-libopenh264-dlopen enable H.264 encoding via dlopen()'ed OpenH264 [no] - --enable-libopenjpeg enable JPEG 2000 de/encoding via OpenJPEG [no] - --enable-libopenmpt enable decoding tracked files via libopenmpt [no] - --enable-libopenvino enable OpenVINO as a DNN module backend -@@ -1871,6 +1872,7 @@ EXTERNAL_LIBRARY_LIST=" - libmysofa - libopencv - libopenh264 -+ libopenh264_dlopen - libopenjpeg - libopenmpt - libopenvino -@@ -6765,6 +6767,7 @@ enabled libopencv && { check_headers opencv2/core/core_c.h && - require libopencv opencv2/core/core_c.h cvCreateImageHeader -lopencv_core -lopencv_imgproc; } || - require_pkg_config libopencv opencv opencv/cxcore.h cvCreateImageHeader; } - enabled libopenh264 && require_pkg_config libopenh264 openh264 wels/codec_api.h WelsGetCodecVersion -+enabled libopenh264_dlopen && enable libopenh264 && add_cppflags "-I$(dirname `readlink -f $0`)/ffdlopenhdrs/include -DCONFIG_LIBOPENH264_DLOPEN=1" - enabled libopenjpeg && { check_pkg_config libopenjpeg "libopenjp2 >= 2.1.0" openjpeg.h opj_version || - { require_pkg_config libopenjpeg "libopenjp2 >= 2.1.0" openjpeg.h opj_version -DOPJ_STATIC && add_cppflags -DOPJ_STATIC; } } - enabled libopenmpt && require_pkg_config libopenmpt "libopenmpt >= 0.2.6557" libopenmpt/libopenmpt.h openmpt_module_create -lstdc++ && append libopenmpt_extralibs "-lstdc++" -diff --git a/libavcodec/Makefile b/libavcodec/Makefile -index 580a8d6b54..c27d229f6d 100644 ---- a/libavcodec/Makefile -+++ b/libavcodec/Makefile -@@ -1115,6 +1115,7 @@ OBJS-$(CONFIG_LIBMP3LAME_ENCODER) += libmp3lame.o - OBJS-$(CONFIG_LIBOPENCORE_AMRNB_DECODER) += libopencore-amr.o - OBJS-$(CONFIG_LIBOPENCORE_AMRNB_ENCODER) += libopencore-amr.o - OBJS-$(CONFIG_LIBOPENCORE_AMRWB_DECODER) += libopencore-amr.o -+OBJS-$(CONFIG_LIBOPENH264_DLOPEN) += libopenh264_dlopen.o - OBJS-$(CONFIG_LIBOPENH264_DECODER) += libopenh264dec.o libopenh264.o - OBJS-$(CONFIG_LIBOPENH264_ENCODER) += libopenh264enc.o libopenh264.o - OBJS-$(CONFIG_LIBOPENJPEG_ENCODER) += libopenjpegenc.o -diff --git a/libavcodec/libopenh264.c b/libavcodec/libopenh264.c -index c80c85ea8b..128c3d9846 100644 ---- a/libavcodec/libopenh264.c -+++ b/libavcodec/libopenh264.c -@@ -20,8 +20,13 @@ - */ - - #include -+ -+#ifdef CONFIG_LIBOPENH264_DLOPEN -+#include "libopenh264_dlopen.h" -+#else - #include - #include -+#endif - - #include "libavutil/error.h" - #include "libavutil/log.h" -diff --git a/libavcodec/libopenh264_dlopen.c b/libavcodec/libopenh264_dlopen.c -new file mode 100644 -index 0000000000..49ea8ff44f ---- /dev/null -+++ b/libavcodec/libopenh264_dlopen.c -@@ -0,0 +1,147 @@ -+/* -+ * OpenH264 dlopen code -+ * -+ * Copyright (C) 2022 Andreas Schneider -+ * -+ * This file is part of FFmpeg. -+ * -+ * FFmpeg is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License as published by the Free Software Foundation; either -+ * version 2.1 of the License, or (at your option) any later version. -+ * -+ * FFmpeg is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with FFmpeg; if not, write to the Free Software -+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -+ */ -+ -+#include -+ -+#include "libopenh264_dlopen.h" -+ -+/* -+ * The symbol binding makes sure we do not run into strict aliasing issues which -+ * can lead into segfaults. -+ */ -+typedef int (*__oh264_WelsCreateSVCEncoder)(ISVCEncoder **); -+typedef void (*__oh264_WelsDestroySVCEncoder)(ISVCEncoder *); -+typedef int (*__oh264_WelsGetDecoderCapability)(SDecoderCapability *); -+typedef long (*__oh264_WelsCreateDecoder)(ISVCDecoder **); -+typedef void (*__oh264_WelsDestroyDecoder)(ISVCDecoder *); -+typedef OpenH264Version (*__oh264_WelsGetCodecVersion)(void); -+typedef void (*__oh264_WelsGetCodecVersionEx)(OpenH264Version *); -+ -+#define OH264_SYMBOL_ENTRY(i) \ -+ union { \ -+ __oh264_##i f; \ -+ void *obj; \ -+ } _oh264_##i -+ -+struct oh264_symbols { -+ OH264_SYMBOL_ENTRY(WelsCreateSVCEncoder); -+ OH264_SYMBOL_ENTRY(WelsDestroySVCEncoder); -+ OH264_SYMBOL_ENTRY(WelsGetDecoderCapability); -+ OH264_SYMBOL_ENTRY(WelsCreateDecoder); -+ OH264_SYMBOL_ENTRY(WelsDestroyDecoder); -+ OH264_SYMBOL_ENTRY(WelsGetCodecVersion); -+ OH264_SYMBOL_ENTRY(WelsGetCodecVersionEx); -+}; -+ -+/* Symbols are bound by loadLibOpenH264() */ -+static struct oh264_symbols openh264_symbols; -+ -+int oh264_WelsCreateSVCEncoder(ISVCEncoder **ppEncoder) { -+ return openh264_symbols._oh264_WelsCreateSVCEncoder.f(ppEncoder); -+} -+ -+void oh264_WelsDestroySVCEncoder(ISVCEncoder *pEncoder) { -+ return openh264_symbols._oh264_WelsDestroySVCEncoder.f(pEncoder); -+} -+ -+int oh264_WelsGetDecoderCapability(SDecoderCapability *pDecCapability) { -+ return openh264_symbols._oh264_WelsGetDecoderCapability.f(pDecCapability); -+} -+ -+long oh264_WelsCreateDecoder(ISVCDecoder **ppDecoder) { -+ return openh264_symbols._oh264_WelsCreateDecoder.f(ppDecoder); -+} -+ -+void oh264_WelsDestroyDecoder(ISVCDecoder *pDecoder) { -+ return openh264_symbols._oh264_WelsDestroyDecoder.f(pDecoder); -+} -+ -+OpenH264Version oh264_WelsGetCodecVersion(void) { -+ return openh264_symbols._oh264_WelsGetCodecVersion.f(); -+} -+ -+void oh264_WelsGetCodecVersionEx(OpenH264Version *pVersion) { -+ openh264_symbols._oh264_WelsGetCodecVersionEx.f(pVersion); -+} -+ -+static void *_oh264_bind_symbol(AVCodecContext *avctx, -+ void *handle, -+ const char *sym_name) { -+ void *sym = NULL; -+ -+ sym = dlsym(handle, sym_name); -+ if (sym == NULL) { -+ const char *err = dlerror(); -+ av_log(avctx, -+ AV_LOG_WARNING, -+ "%s: Failed to bind %s\n", -+ err, -+ sym_name); -+ return NULL; -+ } -+ -+ return sym; -+} -+ -+#define oh264_bind_symbol(avctx, handle, sym_name) \ -+ if (openh264_symbols._oh264_##sym_name.obj == NULL) { \ -+ openh264_symbols._oh264_##sym_name.obj = _oh264_bind_symbol(avctx, handle, #sym_name); \ -+ if (openh264_symbols._oh264_##sym_name.obj == NULL) { \ -+ return 1; \ -+ } \ -+ } -+ -+int loadLibOpenH264(AVCodecContext *avctx) { -+ static bool initialized = false; -+ void *libopenh264 = NULL; -+ const char *err = NULL; -+ -+ if (initialized) { -+ return 0; -+ } -+ -+#define OPENH264_LIB "libopenh264.so.7" -+ libopenh264 = dlopen(OPENH264_LIB, RTLD_LAZY); -+ err = dlerror(); -+ if (err != NULL) { -+ av_log(avctx, AV_LOG_WARNING, -+ "%s: %s is missing, openh264 support will be disabled\n", err, -+ OPENH264_LIB); -+ -+ if (libopenh264 != NULL) { -+ dlclose(libopenh264); -+ } -+ return 1; -+ } -+ -+ oh264_bind_symbol(avctx, libopenh264, WelsCreateSVCEncoder); -+ oh264_bind_symbol(avctx, libopenh264, WelsDestroySVCEncoder); -+ oh264_bind_symbol(avctx, libopenh264, WelsGetDecoderCapability); -+ oh264_bind_symbol(avctx, libopenh264, WelsCreateDecoder); -+ oh264_bind_symbol(avctx, libopenh264, WelsDestroyDecoder); -+ oh264_bind_symbol(avctx, libopenh264, WelsGetCodecVersion); -+ oh264_bind_symbol(avctx, libopenh264, WelsGetCodecVersionEx); -+ -+ initialized = true; -+ -+ return 0; -+} -diff --git a/libavcodec/libopenh264_dlopen.h b/libavcodec/libopenh264_dlopen.h -new file mode 100644 -index 0000000000..d7d8bb7cad ---- /dev/null -+++ b/libavcodec/libopenh264_dlopen.h -@@ -0,0 +1,58 @@ -+/* -+ * OpenH264 dlopen code -+ * -+ * Copyright (C) 2022 Andreas Schneider -+ * -+ * This file is part of FFmpeg. -+ * -+ * FFmpeg is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License as published by the Free Software Foundation; either -+ * version 2.1 of the License, or (at your option) any later version. -+ * -+ * FFmpeg is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with FFmpeg; if not, write to the Free Software -+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -+ */ -+ -+#ifndef HAVE_LIBOPENH264_DLOPEN_H -+#define HAVE_LIBOPENH264_DLOPEN_H -+ -+#ifdef CONFIG_LIBOPENH264_DLOPEN -+ -+#include -+#include -+ -+#include "avcodec.h" -+ -+int oh264_WelsCreateSVCEncoder(ISVCEncoder **ppEncoder); -+#define WelsCreateSVCEncoder oh264_WelsCreateSVCEncoder -+ -+void oh264_WelsDestroySVCEncoder(ISVCEncoder *pEncoder); -+#define WelsDestroySVCEncoder oh264_WelsDestroySVCEncoder -+ -+int oh264_WelsGetDecoderCapability(SDecoderCapability *pDecCapability); -+#define WelsGetDecoderCapability oh264_WelsGetDecoderCapability -+ -+long oh264_WelsCreateDecoder(ISVCDecoder **ppDecoder); -+#define WelsCreateDecoder oh264_WelsCreateDecoder -+ -+void oh264_WelsDestroyDecoder(ISVCDecoder *pDecoder); -+#define WelsDestroyDecoder oh264_WelsDestroyDecoder -+ -+OpenH264Version oh264_WelsGetCodecVersion(void); -+#define WelsGetCodecVersion oh264_WelsGetCodecVersion -+ -+void oh264_WelsGetCodecVersionEx(OpenH264Version *pVersion); -+#define WelsGetCodecVersionEx oh264_WelsGetCodecVersionEx -+ -+int loadLibOpenH264(AVCodecContext *avctx); -+ -+#endif /* CONFIG_LIBOPENH264_DLOPEN */ -+ -+#endif /* HAVE_LIBOPENH264_DLOPEN_H */ -diff --git a/libavcodec/libopenh264dec.c b/libavcodec/libopenh264dec.c -index b6a9bba2dc..e042189161 100644 ---- a/libavcodec/libopenh264dec.c -+++ b/libavcodec/libopenh264dec.c -@@ -19,8 +19,12 @@ - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -+#ifdef CONFIG_LIBOPENH264_DLOPEN -+#include "libopenh264_dlopen.h" -+#else - #include - #include -+#endif - - #include "libavutil/common.h" - #include "libavutil/fifo.h" -@@ -55,6 +59,12 @@ static av_cold int svc_decode_init(AVCodecContext *avctx) - int log_level; - WelsTraceCallback callback_function; - -+#ifdef CONFIG_LIBOPENH264_DLOPEN -+ if (loadLibOpenH264(avctx)) { -+ return AVERROR_DECODER_NOT_FOUND; -+ } -+#endif -+ - 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 6f231d22b2..3f0e990d80 100644 ---- a/libavcodec/libopenh264enc.c -+++ b/libavcodec/libopenh264enc.c -@@ -19,8 +19,12 @@ - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -+#ifdef CONFIG_LIBOPENH264_DLOPEN -+#include "libopenh264_dlopen.h" -+#else - #include - #include -+#endif - - #include "libavutil/attributes.h" - #include "libavutil/common.h" -@@ -114,6 +118,12 @@ static av_cold int svc_encode_init(AVCodecContext *avctx) - WelsTraceCallback callback_function; - AVCPBProperties *props; - -+#ifdef CONFIG_LIBOPENH264_DLOPEN -+ if (loadLibOpenH264(avctx)) { -+ return AVERROR_ENCODER_NOT_FOUND; -+ } -+#endif -+ - if (WelsCreateSVCEncoder(&s->encoder)) { - av_log(avctx, AV_LOG_ERROR, "Unable to create encoder\n"); - return AVERROR_UNKNOWN; --- -2.43.0 - diff --git a/ffmpeg-gcc14.patch b/ffmpeg-gcc14.patch deleted file mode 100644 index 99dd6af..0000000 --- a/ffmpeg-gcc14.patch +++ /dev/null @@ -1,131 +0,0 @@ -From 68ef9a29478fad450ec29ec14120afad3938e75b Mon Sep 17 00:00:00 2001 -From: Sandro Mani -Date: Tue, 30 Jan 2024 09:16:13 +0100 -Subject: [PATCH] Fix -Wint-conversion and -Wincompatible-pointer-types errors - ---- - libavcodec/pcm-bluray.c | 4 ++-- - libavcodec/pcm-dvd.c | 2 +- - libavcodec/vulkan_av1.c | 2 +- - libavcodec/vulkan_decode.c | 6 +++--- - libavcodec/vulkan_video.c | 2 +- - libavfilter/vsrc_testsrc_vulkan.c | 4 ++-- - libavutil/hwcontext_vaapi.c | 2 +- - 7 files changed, 11 insertions(+), 11 deletions(-) - -diff --git a/libavcodec/pcm-bluray.c b/libavcodec/pcm-bluray.c -index f656095..56fa373 100644 ---- a/libavcodec/pcm-bluray.c -+++ b/libavcodec/pcm-bluray.c -@@ -167,7 +167,7 @@ static int pcm_bluray_decode_frame(AVCodecContext *avctx, AVFrame *frame, - samples *= num_source_channels; - if (AV_SAMPLE_FMT_S16 == avctx->sample_fmt) { - #if HAVE_BIGENDIAN -- bytestream2_get_buffer(&gb, dst16, buf_size); -+ bytestream2_get_buffer(&gb, (uint8_t*)dst16, buf_size); - #else - do { - *dst16++ = bytestream2_get_be16u(&gb); -@@ -187,7 +187,7 @@ static int pcm_bluray_decode_frame(AVCodecContext *avctx, AVFrame *frame, - if (AV_SAMPLE_FMT_S16 == avctx->sample_fmt) { - do { - #if HAVE_BIGENDIAN -- bytestream2_get_buffer(&gb, dst16, avctx->ch_layout.nb_channels * 2); -+ bytestream2_get_buffer(&gb, (uint8_t*)dst16, avctx->ch_layout.nb_channels * 2); - dst16 += avctx->ch_layout.nb_channels; - #else - channel = avctx->ch_layout.nb_channels; -diff --git a/libavcodec/pcm-dvd.c b/libavcodec/pcm-dvd.c -index 419b2a1..319746c 100644 ---- a/libavcodec/pcm-dvd.c -+++ b/libavcodec/pcm-dvd.c -@@ -157,7 +157,7 @@ static void *pcm_dvd_decode_samples(AVCodecContext *avctx, const uint8_t *src, - switch (avctx->bits_per_coded_sample) { - case 16: { - #if HAVE_BIGENDIAN -- bytestream2_get_buffer(&gb, dst16, blocks * s->block_size); -+ bytestream2_get_buffer(&gb, (uint8_t*)dst16, blocks * s->block_size); - dst16 += blocks * s->block_size / 2; - #else - int samples = blocks * avctx->ch_layout.nb_channels; -diff --git a/libavcodec/vulkan_av1.c b/libavcodec/vulkan_av1.c -index 4998bf7..9730e4b 100644 ---- a/libavcodec/vulkan_av1.c -+++ b/libavcodec/vulkan_av1.c -@@ -180,7 +180,7 @@ static int vk_av1_create_params(AVCodecContext *avctx, AVBufferRef **buf) - .sType = VK_STRUCTURE_TYPE_VIDEO_SESSION_PARAMETERS_CREATE_INFO_KHR, - .pNext = &av1_params, - .videoSession = ctx->common.session, -- .videoSessionParametersTemplate = NULL, -+ .videoSessionParametersTemplate = VK_NULL_HANDLE, - }; - - err = ff_vk_decode_create_params(buf, avctx, ctx, &session_params_create); -diff --git a/libavcodec/vulkan_decode.c b/libavcodec/vulkan_decode.c -index a89d84f..fdbcbb4 100644 ---- a/libavcodec/vulkan_decode.c -+++ b/libavcodec/vulkan_decode.c -@@ -188,9 +188,9 @@ int ff_vk_decode_prepare_frame(FFVulkanDecodeContext *dec, AVFrame *pic, - return 0; - - vkpic->dpb_frame = NULL; -- vkpic->img_view_ref = NULL; -- vkpic->img_view_out = NULL; -- vkpic->img_view_dest = NULL; -+ vkpic->img_view_ref = VK_NULL_HANDLE; -+ vkpic->img_view_out = VK_NULL_HANDLE; -+ vkpic->img_view_dest = VK_NULL_HANDLE; - - vkpic->destroy_image_view = vk->DestroyImageView; - vkpic->wait_semaphores = vk->WaitSemaphores; -diff --git a/libavcodec/vulkan_video.c b/libavcodec/vulkan_video.c -index 236aa12..c5144bd 100644 ---- a/libavcodec/vulkan_video.c -+++ b/libavcodec/vulkan_video.c -@@ -287,7 +287,7 @@ av_cold void ff_vk_video_common_uninit(FFVulkanContext *s, - if (common->session) { - vk->DestroyVideoSessionKHR(s->hwctx->act_dev, common->session, - s->hwctx->alloc); -- common->session = NULL; -+ common->session = VK_NULL_HANDLE; - } - - if (common->nb_mem && common->mem) -diff --git a/libavfilter/vsrc_testsrc_vulkan.c b/libavfilter/vsrc_testsrc_vulkan.c -index 8761c21..1720bfa 100644 ---- a/libavfilter/vsrc_testsrc_vulkan.c -+++ b/libavfilter/vsrc_testsrc_vulkan.c -@@ -231,7 +231,7 @@ static int testsrc_vulkan_activate(AVFilterContext *ctx) - return AVERROR(ENOMEM); - - err = ff_vk_filter_process_simple(&s->vkctx, &s->e, &s->pl, s->picref, NULL, -- NULL, &s->opts, sizeof(s->opts)); -+ VK_NULL_HANDLE, &s->opts, sizeof(s->opts)); - if (err < 0) - return err; - } -@@ -250,7 +250,7 @@ static int testsrc_vulkan_activate(AVFilterContext *ctx) - frame->sample_aspect_ratio = s->sar; - if (!s->draw_once) { - err = ff_vk_filter_process_simple(&s->vkctx, &s->e, &s->pl, frame, NULL, -- NULL, &s->opts, sizeof(s->opts)); -+ VK_NULL_HANDLE, &s->opts, sizeof(s->opts)); - if (err < 0) { - av_frame_free(&frame); - return err; -diff --git a/libavutil/hwcontext_vaapi.c b/libavutil/hwcontext_vaapi.c -index 12bc951..d326ad6 100644 ---- a/libavutil/hwcontext_vaapi.c -+++ b/libavutil/hwcontext_vaapi.c -@@ -1203,7 +1203,7 @@ static int vaapi_map_from_drm(AVHWFramesContext *src_fc, AVFrame *dst, - - if (!use_prime2 || vas != VA_STATUS_SUCCESS) { - int k; -- unsigned long buffer_handle; -+ size_t buffer_handle; - VASurfaceAttribExternalBuffers buffer_desc; - VASurfaceAttrib buffer_attrs[2] = { - { --- -2.43.0 - diff --git a/ffmpeg.spec b/ffmpeg.spec index d4f39d2..cc08ae6 100644 --- a/ffmpeg.spec +++ b/ffmpeg.spec @@ -1,9 +1,9 @@ # For a complete build enable these two -%bcond_with upstream_tarball -%bcond_with all_codecs +%bcond upstream_tarball 0 +%bcond all_codecs 0 # Break dependency cycles by disabling certain optional dependencies. -%bcond_with bootstrap +%bcond bootstrap 0 # If you want to do a build with the upstream source tarball, then set the # pkg_suffix to %%nil. We can't handle this with a conditional, as srpm @@ -12,100 +12,90 @@ # Fails due to asm issue %ifarch %{ix86} %{arm} -%bcond_with lto +%bcond lto 0 %else -%bcond_without lto +%bcond lto 1 %endif %ifarch x86_64 -%bcond_without vpl -%bcond_without vmaf +%bcond vpl 1 +%bcond vmaf 1 %else -%bcond_with vpl -%bcond_with vmaf +%bcond vpl 0 +%bcond vmaf 0 %endif %ifarch s390 s390x -%bcond_with dc1394 +%bcond dc1394 0 %else -%bcond_without dc1394 +%bcond dc1394 1 %endif %if 0%{?rhel} # Disable dependencies not offered in RHEL/EPEL -%bcond_with omxil +%bcond omxil 0 %else -# Use bundled openh264 headers on older Fedora/RHEL where the noopenh264 stub -# package is not available -%if 0%{?fedora} && 0%{?fedora} <= 39 || 0%{?rhel} && 0%{?rhel} <= 9 -%bcond_without bundled_openh264_headers -%else -%bcond_with bundled_openh264_headers -%endif - # Disable some features because RHEL 9 packages are too old %if 0%{?rhel} && 0%{?rhel} <= 9 -%bcond_with flite -%bcond_with lcms2 -%bcond_with placebo +%bcond flite 0 +%bcond lcms2 0 +%bcond placebo 0 %else -%bcond_without flite -%bcond_without lcms2 -%bcond_without placebo +%bcond flite 1 +%bcond lcms2 1 +%bcond placebo 1 %endif -%bcond_without omxil +%bcond omxil 1 %endif # Break chromaprint dependency cycle (Fedora-only): # ffmpeg (libavcodec-free) → chromaprint → ffmpeg %if %{with bootstrap} -%bcond_with chromaprint +%bcond chromaprint 0 %else -%bcond_without chromaprint +%bcond chromaprint 1 %endif %if %{with all_codecs} -%bcond_without rtmp -%bcond_without x264 -%bcond_without x265 +%bcond evc 1 +%bcond rtmp 1 +%bcond vvc 1 +%bcond x264 1 +%bcond x265 1 %else -%bcond_with rtmp -%bcond_with x264 -%bcond_with x265 +%bcond evc 0 +%bcond rtmp 0 +%bcond vvc 0 +%bcond x264 0 +%bcond x265 0 %endif %if %{without lto} %global _lto_cflags %{nil} %endif -%if "%{__isa_bits}" == "64" -%global lib64_suffix ()(64bit) -%endif -%global openh264_soversion 7 - -%global av_codec_soversion 60 -%global av_device_soversion 60 -%global av_filter_soversion 9 -%global av_format_soversion 60 -%global av_util_soversion 58 -%global postproc_soversion 57 -%global swresample_soversion 4 -%global swscale_soversion 7 +%global av_codec_soversion 61 +%global av_device_soversion 61 +%global av_filter_soversion 10 +%global av_format_soversion 61 +%global av_util_soversion 59 +%global postproc_soversion 58 +%global swresample_soversion 5 +%global swscale_soversion 8 Name: ffmpeg %global pkg_name %{name}%{?pkg_suffix} -Version: 6.1.2 +Version: 7.0.2 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/ Source0: ffmpeg%{?pkg_suffix}-%{version}.tar.xz -Source1: ffmpeg-dlopen-headers.tar.xz Source2: https://ffmpeg.org/releases/ffmpeg-%{version}.tar.xz.asc # https://ffmpeg.org/ffmpeg-devel.asc # gpg2 --import --import-options import-export,import-minimal ffmpeg-devel.asc > ./ffmpeg.keyring @@ -116,29 +106,16 @@ Source21: enable_encoders # Scripts for generating tarballs Source90: ffmpeg_update_free_sources.sh Source91: ffmpeg_gen_free_tarball.sh -Source92: ffmpeg_get_dlopen_headers.sh -Source93: ffmpeg_find_free_source_headers.sh # Fixes for reduced codec selection on free build Patch1: ffmpeg-codec-choice.patch # Allow to build with fdk-aac-free # See https://bugzilla.redhat.com/show_bug.cgi?id=1501522#c112 Patch2: ffmpeg-allow-fdk-aac-free.patch -# Drop openh264 runtime version checks -# https://patchwork.ffmpeg.org/project/ffmpeg/list/?series=10211 -Patch4: 0001-lavc-libopenh264-Drop-openh264-runtime-version-check.patch -Patch5: ffmpeg-c99.patch -# Fix build with gcc14 (-Wint-conversion, -Wincompatible-pointer-types) -Patch6: ffmpeg-gcc14.patch -# Backport fix for CVE-2023-49528 -Patch8: https://git.ffmpeg.org/gitweb/ffmpeg.git/patch/2d9ed64859c9887d0504cd71dbd5b2c15e14251a#/ffmpeg-CVE-2023-49528.patch # Fixes for Mesa 24.0.6+ / 24.1.4+ VA-API Patch9: 0001-lavc-vaapi_decode-Make-it-possible-to-send-multiple-.patch Patch10: 0002-lavc-vaapi_av1-Avoid-sending-the-same-slice-buffer-m.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 @@ -180,6 +157,8 @@ BuildRequires: pkgconfig(bzip2) BuildRequires: pkgconfig(caca) BuildRequires: pkgconfig(codec2) BuildRequires: pkgconfig(dav1d) +BuildRequires: pkgconfig(dvdnav) +BuildRequires: pkgconfig(dvdread) BuildRequires: pkgconfig(ffnvcodec) BuildRequires: pkgconfig(flac) BuildRequires: pkgconfig(fontconfig) @@ -214,6 +193,7 @@ BuildRequires: pkgconfig(libopenmpt) BuildRequires: pkgconfig(libplacebo) >= 4.192.0 %endif BuildRequires: pkgconfig(libpulse) +BuildRequires: pkgconfig(libqrencode) BuildRequires: pkgconfig(librabbitmq) BuildRequires: pkgconfig(librist) BuildRequires: pkgconfig(librsvg-2.0) @@ -232,9 +212,7 @@ BuildRequires: pkgconfig(ogg) BuildRequires: pkgconfig(openal) BuildRequires: pkgconfig(opencore-amrnb) BuildRequires: pkgconfig(OpenCL) -%if %{without bundled_openh264_headers} BuildRequires: pkgconfig(openh264) -%endif BuildRequires: pkgconfig(opus) BuildRequires: pkgconfig(rav1e) BuildRequires: pkgconfig(rubberband) @@ -280,6 +258,10 @@ BuildRequires: librtmp-devel %if %{with vpl} BuildRequires: pkgconfig(vpl) >= 2.6 %endif +%if %{with evc} +BuildRequires: pkgconfig(libxevd) +BuildRequires: pkgconfig(libxeve) +%endif %if %{with x264} BuildRequires: pkgconfig(x264) %endif @@ -352,10 +334,8 @@ community or a corporation. Summary: FFmpeg codec library Requires: libavutil%{?pkg_suffix}%{_isa} = %{version}-%{release} Requires: libswresample%{?pkg_suffix}%{_isa} = %{version}-%{release} -# We dlopen() openh264, so weak-depend on it... -## 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} +# We require libopenh264 library, which has a dummy implementation and a real one +# In the event that this is being installed, we want to prefer openh264 if available Suggests: openh264%{_isa} %description -n libavcodec%{?pkg_suffix} @@ -566,7 +546,7 @@ This subpackage contains the headers for FFmpeg libswscale. %{gpgverify} --keyring='%{SOURCE3}' --signature='%{SOURCE2}' --data='%{SOURCE0}' %endif -%autosetup %{?with_bundled_openh264_headers:-a1} -S git_am +%autosetup -S git_am install -m 0644 %{SOURCE20} enable_decoders install -m 0644 %{SOURCE21} enable_encoders # fix -O3 -g in host_cflags @@ -625,7 +605,8 @@ cp -a doc/examples/{*.c,Makefile,README} _doc/examples/ %if %{with dc1394} --enable-libdc1394 \ %endif - --enable-libdrm \ + --enable-libdvdnav \ + --enable-libdvdread \ --enable-libfdk-aac \ %if %{with flite} --enable-libflite \ @@ -645,7 +626,6 @@ cp -a doc/examples/{*.c,Makefile,README} _doc/examples/ --enable-libmodplug \ --enable-libmp3lame \ --enable-libmysofa \ - --enable-libopenh264-dlopen \ --enable-libopenjpeg \ --enable-libopenmpt \ --enable-libopus \ @@ -653,6 +633,7 @@ cp -a doc/examples/{*.c,Makefile,README} _doc/examples/ --enable-libplacebo \ %endif --enable-libpulse \ + --enable-libqrencode \ --enable-librabbitmq \ --enable-librav1e \ --enable-librist \ @@ -691,6 +672,10 @@ cp -a doc/examples/{*.c,Makefile,README} _doc/examples/ --enable-libopencore-amrnb \ --enable-libopencore-amrwb \ --enable-libvo-amrwbenc \ +%if %{with evc} + --enable-libxeve \ + --enable-libxevd \ +%endif %if %{with x264} --enable-libx264 \ %endif @@ -712,7 +697,7 @@ cp -a doc/examples/{*.c,Makefile,README} _doc/examples/ --enable-hwaccels \ --disable-encoders \ --disable-decoders \ - --disable-decoder="h264,hevc,vc1" \ + --disable-decoder="h264,hevc,libxevd,vc1,vvc" \ --enable-encoder="$(perl -pe 's{^(\w*).*}{$1,}gs' - 7.0.2-1 +- Rebase to 7.0.2 (rhbz#2273572) +- Drop OpenH264 dlopen headers as we use noopenh264 now +- Use modern bconds + * Sat Aug 24 2024 Fabio Valentini - 6.1.2-1 - Update to 6.1.2 diff --git a/ffmpeg_free_sources b/ffmpeg_free_sources index ee8be40..34eb548 100644 --- a/ffmpeg_free_sources +++ b/ffmpeg_free_sources @@ -86,6 +86,7 @@ doc/general.texi doc/general_contents.texi doc/git-howto.texi doc/indevs.texi +doc/infra.txt doc/issue_tracker.txt doc/lexicon doc/libav-merge.txt @@ -145,7 +146,12 @@ fftools/ffmpeg_mux.c fftools/ffmpeg_mux.h fftools/ffmpeg_mux_init.c fftools/ffmpeg_opt.c +fftools/ffmpeg_sched.c +fftools/ffmpeg_sched.h +fftools/ffmpeg_utils.h fftools/ffplay.c +fftools/ffplay_renderer.c +fftools/ffplay_renderer.h fftools/ffprobe.c fftools/fopen_utf8.h fftools/objpool.c @@ -167,13 +173,13 @@ libavcodec/a64tables.h libavcodec/aac.h libavcodec/aac_ac3_parser.c libavcodec/aac_ac3_parser.h -libavcodec/aac_adtstoasc_bsf.c libavcodec/aac_defines.h libavcodec/aac_parser.c libavcodec/aaccoder.c libavcodec/aaccoder_trellis.h libavcodec/aaccoder_twoloop.h libavcodec/aacdec.c +libavcodec/aacdec.h libavcodec/aacdec_template.c libavcodec/aacdectab.h libavcodec/aacenc.c @@ -189,6 +195,7 @@ libavcodec/aacenc_quantization_misc.h libavcodec/aacenc_tns.c libavcodec/aacenc_tns.h libavcodec/aacenc_utils.h +libavcodec/aacencdsp.h libavcodec/aacenctab.c libavcodec/aacenctab.h libavcodec/aacps.c @@ -330,6 +337,9 @@ libavcodec/amrwbdata.h libavcodec/amrwbdec.c libavcodec/anm.c libavcodec/ansi.c +libavcodec/aom_film_grain.c +libavcodec/aom_film_grain.h +libavcodec/aom_film_grain_template.c libavcodec/apac.c libavcodec/apedec.c libavcodec/apng.h @@ -487,11 +497,8 @@ libavcodec/audiodsp.c libavcodec/audiodsp.h libavcodec/aura.c libavcodec/av1.h -libavcodec/av1_frame_merge_bsf.c -libavcodec/av1_frame_split_bsf.c libavcodec/av1_levels.c libavcodec/av1_levels.h -libavcodec/av1_metadata_bsf.c libavcodec/av1_parse.c libavcodec/av1_parse.h libavcodec/av1_parser.c @@ -539,6 +546,50 @@ libavcodec/bonk.c libavcodec/brenderpix.c libavcodec/bsf.c libavcodec/bsf.h +libavcodec/bsf/Makefile +libavcodec/bsf/aac_adtstoasc.c +libavcodec/bsf/av1_frame_merge.c +libavcodec/bsf/av1_frame_split.c +libavcodec/bsf/av1_metadata.c +libavcodec/bsf/chomp.c +libavcodec/bsf/dca_core.c +libavcodec/bsf/dts2pts.c +libavcodec/bsf/dump_extradata.c +libavcodec/bsf/dv_error_marker.c +libavcodec/bsf/eac3_core.c +libavcodec/bsf/evc_frame_merge.c +libavcodec/bsf/extract_extradata.c +libavcodec/bsf/filter_units.c +libavcodec/bsf/h264_metadata.c +libavcodec/bsf/h264_mp4toannexb.c +libavcodec/bsf/h264_redundant_pps.c +libavcodec/bsf/h265_metadata.c +libavcodec/bsf/h266_metadata.c +libavcodec/bsf/hapqa_extract.c +libavcodec/bsf/hevc_mp4toannexb.c +libavcodec/bsf/imx_dump_header.c +libavcodec/bsf/media100_to_mjpegb.c +libavcodec/bsf/mjpeg2jpeg.c +libavcodec/bsf/mjpega_dump_header.c +libavcodec/bsf/movsub.c +libavcodec/bsf/mpeg2_metadata.c +libavcodec/bsf/mpeg4_unpack_bframes.c +libavcodec/bsf/noise.c +libavcodec/bsf/null.c +libavcodec/bsf/opus_metadata.c +libavcodec/bsf/pcm_rechunk.c +libavcodec/bsf/pgs_frame_merge.c +libavcodec/bsf/prores_metadata.c +libavcodec/bsf/remove_extradata.c +libavcodec/bsf/setts.c +libavcodec/bsf/showinfo.c +libavcodec/bsf/trace_headers.c +libavcodec/bsf/truehd_core.c +libavcodec/bsf/vp9_metadata.c +libavcodec/bsf/vp9_raw_reorder.c +libavcodec/bsf/vp9_superframe.c +libavcodec/bsf/vp9_superframe_split.c +libavcodec/bsf/vvc_mp4toannexb.c libavcodec/bsf_internal.h libavcodec/bswapdsp.c libavcodec/bswapdsp.h @@ -578,6 +629,9 @@ libavcodec/cbs_mpeg2_syntax_template.c libavcodec/cbs_sei.c libavcodec/cbs_sei.h libavcodec/cbs_sei_syntax_template.c +libavcodec/cbs_vp8.c +libavcodec/cbs_vp8.h +libavcodec/cbs_vp8_syntax_template.c libavcodec/cbs_vp9.c libavcodec/cbs_vp9.h libavcodec/cbs_vp9_syntax_template.c @@ -591,7 +645,6 @@ libavcodec/celp_math.c libavcodec/celp_math.h libavcodec/cga_data.c libavcodec/cga_data.h -libavcodec/chomp_bsf.c libavcodec/cinepak.c libavcodec/cinepakenc.c libavcodec/clearvideo.c @@ -612,16 +665,20 @@ libavcodec/cookdata.h libavcodec/copy_block.h libavcodec/cpia.c libavcodec/cri_parser.c -libavcodec/crystalhd.c libavcodec/cscd.c libavcodec/cyuv.c libavcodec/d3d11va.c libavcodec/d3d11va.h +libavcodec/d3d12va_av1.c +libavcodec/d3d12va_decode.c +libavcodec/d3d12va_decode.h +libavcodec/d3d12va_mpeg2.c +libavcodec/d3d12va_vc1.c +libavcodec/d3d12va_vp9.c libavcodec/dca.c libavcodec/dca.h libavcodec/dca_core.c libavcodec/dca_core.h -libavcodec/dca_core_bsf.c libavcodec/dca_exss.c libavcodec/dca_exss.h libavcodec/dca_lbr.c @@ -684,6 +741,7 @@ libavcodec/dolby_e.c libavcodec/dolby_e.h libavcodec/dolby_e_parse.c libavcodec/dolby_e_parser.c +libavcodec/dovi_rpu.c libavcodec/dovi_rpu.h libavcodec/dpcm.c libavcodec/dpx.c @@ -695,11 +753,8 @@ libavcodec/dsddec.c libavcodec/dsicinaudio.c libavcodec/dsicinvideo.c libavcodec/dss_sp.c -libavcodec/dts2pts_bsf.c -libavcodec/dump_extradata_bsf.c libavcodec/dv.c libavcodec/dv.h -libavcodec/dv_error_marker_bsf.c libavcodec/dv_internal.h libavcodec/dv_profile.c libavcodec/dv_profile.h @@ -727,7 +782,6 @@ libavcodec/dxtory.c libavcodec/dxva2.h libavcodec/dynamic_hdr_vivid.c libavcodec/dynamic_hdr_vivid.h -libavcodec/eac3_core_bsf.c libavcodec/eac3_data.h libavcodec/eac3dec.c libavcodec/eac3enc.h @@ -747,7 +801,6 @@ libavcodec/error_resilience.h libavcodec/escape124.c libavcodec/escape130.c libavcodec/evc.h -libavcodec/evc_frame_merge_bsf.c libavcodec/evc_parse.c libavcodec/evc_parse.h libavcodec/evc_parser.c @@ -761,7 +814,6 @@ libavcodec/exr.c libavcodec/exrdsp.c libavcodec/exrdsp.h libavcodec/exrenc.c -libavcodec/extract_extradata_bsf.c libavcodec/faandct.c libavcodec/faandct.h libavcodec/faanidct.c @@ -780,7 +832,6 @@ libavcodec/ffv1dec_template.c libavcodec/ffv1enc.c libavcodec/ffv1enc_template.c libavcodec/ffwavesynth.c -libavcodec/filter_units_bsf.c libavcodec/fits.c libavcodec/fits.h libavcodec/fitsdec.c @@ -876,14 +927,11 @@ libavcodec/h2645data.c libavcodec/h2645data.h libavcodec/h264_levels.c libavcodec/h264_levels.h -libavcodec/h264_metadata_bsf.c -libavcodec/h264_mp4toannexb_bsf.c libavcodec/h264_parse.c libavcodec/h264_parse.h libavcodec/h264_parser.c libavcodec/h264_ps.c libavcodec/h264_ps.h -libavcodec/h264_redundant_pps_bsf.c libavcodec/h264_sei.c libavcodec/h264_sei.h libavcodec/h264addpx_template.c @@ -905,17 +953,17 @@ libavcodec/h264pred_template.c libavcodec/h264qpel.c libavcodec/h264qpel.h libavcodec/h264qpel_template.c -libavcodec/h265_metadata_bsf.c libavcodec/h265_profile_level.c libavcodec/h265_profile_level.h -libavcodec/h266_metadata_bsf.c +libavcodec/h26x/h2656_deblock_template.c +libavcodec/h26x/h2656_inter_template.c +libavcodec/h26x/h2656_sao_template.c libavcodec/h274.h libavcodec/half2float.c libavcodec/hap.c libavcodec/hap.h libavcodec/hapdec.c libavcodec/hapenc.c -libavcodec/hapqa_extract_bsf.c libavcodec/hca_data.h libavcodec/hcadec.c libavcodec/hcom.c @@ -925,7 +973,6 @@ libavcodec/hdrenc.c libavcodec/hevc.h libavcodec/hevc_data.c libavcodec/hevc_data.h -libavcodec/hevc_mp4toannexb_bsf.c libavcodec/hevc_parse.c libavcodec/hevc_parse.h libavcodec/hevc_parser.c @@ -942,8 +989,7 @@ libavcodec/hpel_template.c libavcodec/hpeldsp.c libavcodec/hpeldsp.h libavcodec/hq_hqa.c -libavcodec/hq_hqa.h -libavcodec/hq_hqadata.c +libavcodec/hq_hqadata.h libavcodec/hq_hqadsp.c libavcodec/hq_hqadsp.h libavcodec/hqx.c @@ -978,7 +1024,6 @@ libavcodec/imc.c libavcodec/imcdata.h libavcodec/imgconvert.c libavcodec/imx.c -libavcodec/imx_dump_header_bsf.c libavcodec/indeo2.c libavcodec/indeo2data.h libavcodec/indeo3.c @@ -999,6 +1044,7 @@ libavcodec/intrax8huf.h libavcodec/ipu_parser.c libavcodec/ituh263dec.c libavcodec/ituh263enc.c +libavcodec/itut35.h libavcodec/ivi.c libavcodec/ivi.h libavcodec/ivi_dsp.c @@ -1049,6 +1095,7 @@ libavcodec/latm_parser.c libavcodec/lcl.h libavcodec/lcldec.c libavcodec/lclenc.c +libavcodec/leb.h libavcodec/libaom.c libavcodec/libaom.h libavcodec/libaomdec.c @@ -1093,6 +1140,8 @@ libavcodec/libwebpenc.c libavcodec/libwebpenc_animencoder.c libavcodec/libwebpenc_common.c libavcodec/libwebpenc_common.h +libavcodec/libxevd.c +libavcodec/libxeve.c libavcodec/libxvid.c libavcodec/libzvbi-teletextdec.c libavcodec/loco.c @@ -1106,6 +1155,7 @@ libavcodec/lossless_videoencdsp.c libavcodec/lossless_videoencdsp.h libavcodec/lpc.c libavcodec/lpc.h +libavcodec/lpc_functions.h libavcodec/lscrdec.c libavcodec/lsp.c libavcodec/lsp.h @@ -1119,7 +1169,6 @@ libavcodec/mathtables.c libavcodec/mdec.c libavcodec/me_cmp.c libavcodec/me_cmp.h -libavcodec/media100_to_mjpegb_bsf.c libavcodec/mediacodec.c libavcodec/mediacodec.h libavcodec/metasound.c @@ -1134,9 +1183,7 @@ libavcodec/mips/lsp_mips.h libavcodec/misc4.c libavcodec/misc4_parser.c libavcodec/mjpeg.h -libavcodec/mjpeg2jpeg_bsf.c libavcodec/mjpeg_parser.c -libavcodec/mjpega_dump_header_bsf.c libavcodec/mjpegbdec.c libavcodec/mjpegdec.c libavcodec/mjpegdec.h @@ -1162,8 +1209,6 @@ libavcodec/motion_est.h libavcodec/motion_est_template.c libavcodec/motionpixels.c libavcodec/motionpixels_tablegen.h -libavcodec/movsub_bsf.c -libavcodec/mp3_header_decompress_bsf.c libavcodec/mpc.c libavcodec/mpc.h libavcodec/mpc7.c @@ -1183,8 +1228,6 @@ libavcodec/mpeg12enc.c libavcodec/mpeg12enc.h libavcodec/mpeg12framerate.c libavcodec/mpeg12vlc.h -libavcodec/mpeg2_metadata_bsf.c -libavcodec/mpeg4_unpack_bframes_bsf.c libavcodec/mpeg4audio.c libavcodec/mpeg4audio.h libavcodec/mpeg4audio_copy_pce.h @@ -1288,9 +1331,7 @@ libavcodec/nellymoserdec.c libavcodec/nellymoserenc.c libavcodec/neon/Makefile libavcodec/neon/mpegvideo.c -libavcodec/noise_bsf.c libavcodec/null.c -libavcodec/null_bsf.c libavcodec/nuv.c libavcodec/nvdec.c libavcodec/nvdec.h @@ -1313,7 +1354,6 @@ libavcodec/options_table.h libavcodec/opus.h libavcodec/opus_celt.c libavcodec/opus_celt.h -libavcodec/opus_metadata_bsf.c libavcodec/opus_parse.c libavcodec/opus_parse.h libavcodec/opus_parser.c @@ -1346,12 +1386,10 @@ libavcodec/parsers.c libavcodec/pcm-bluray.c libavcodec/pcm-dvd.c libavcodec/pcm.c -libavcodec/pcm_rechunk_bsf.c libavcodec/pcm_tablegen.h libavcodec/pcx.c libavcodec/pcxenc.c libavcodec/pel_template.c -libavcodec/pgs_frame_merge_bsf.c libavcodec/pgssubdec.c libavcodec/pgxdec.c libavcodec/photocd.c @@ -1403,7 +1441,6 @@ libavcodec/ppc/vp3dsp_altivec.c libavcodec/ppc/vp8dsp_altivec.c libavcodec/profiles.c libavcodec/profiles.h -libavcodec/prores_metadata_bsf.c libavcodec/prosumer.c libavcodec/psd.c libavcodec/psymodel.c @@ -1422,6 +1459,7 @@ libavcodec/qdm2_tablegen.h libavcodec/qdm2data.h libavcodec/qdmc.c libavcodec/qdrw.c +libavcodec/qoadec.c libavcodec/qoi.h libavcodec/qoi_parser.c libavcodec/qoidec.c @@ -1466,38 +1504,70 @@ libavcodec/realtextdec.c libavcodec/rectangle.h libavcodec/refstruct.c libavcodec/refstruct.h -libavcodec/remove_extradata_bsf.c libavcodec/reverse.c libavcodec/riscv/Makefile +libavcodec/riscv/aacencdsp_init.c +libavcodec/riscv/aacencdsp_rvv.S libavcodec/riscv/aacpsdsp_init.c libavcodec/riscv/aacpsdsp_rvv.S libavcodec/riscv/ac3dsp_init.c libavcodec/riscv/ac3dsp_rvb.S +libavcodec/riscv/ac3dsp_rvv.S libavcodec/riscv/alacdsp_init.c libavcodec/riscv/alacdsp_rvv.S libavcodec/riscv/audiodsp_init.c libavcodec/riscv/audiodsp_rvf.S libavcodec/riscv/audiodsp_rvv.S +libavcodec/riscv/blockdsp_init.c +libavcodec/riscv/blockdsp_rvv.S libavcodec/riscv/bswapdsp_init.c libavcodec/riscv/bswapdsp_rvb.S libavcodec/riscv/bswapdsp_rvv.S libavcodec/riscv/exrdsp_init.c libavcodec/riscv/exrdsp_rvv.S +libavcodec/riscv/flacdsp_init.c +libavcodec/riscv/flacdsp_rvv.S libavcodec/riscv/fmtconvert_init.c libavcodec/riscv/fmtconvert_rvv.S libavcodec/riscv/g722dsp_init.c libavcodec/riscv/g722dsp_rvv.S libavcodec/riscv/h264_chroma_init_riscv.c libavcodec/riscv/h264_mc_chroma.S +libavcodec/riscv/huffyuvdsp_init.c +libavcodec/riscv/huffyuvdsp_rvv.S libavcodec/riscv/idctdsp_init.c libavcodec/riscv/idctdsp_rvv.S +libavcodec/riscv/jpeg2000dsp_init.c +libavcodec/riscv/jpeg2000dsp_rvv.S +libavcodec/riscv/llauddsp_init.c +libavcodec/riscv/llauddsp_rvv.S +libavcodec/riscv/llviddsp_init.c +libavcodec/riscv/llviddsp_rvv.S +libavcodec/riscv/llvidencdsp_init.c +libavcodec/riscv/llvidencdsp_rvv.S +libavcodec/riscv/lpc_init.c +libavcodec/riscv/lpc_rvv.S +libavcodec/riscv/me_cmp_init.c +libavcodec/riscv/me_cmp_rvv.S libavcodec/riscv/opusdsp_init.c libavcodec/riscv/opusdsp_rvv.S libavcodec/riscv/pixblockdsp_init.c libavcodec/riscv/pixblockdsp_rvi.S libavcodec/riscv/pixblockdsp_rvv.S +libavcodec/riscv/sbrdsp_init.c +libavcodec/riscv/sbrdsp_rvv.S +libavcodec/riscv/svqenc_init.c +libavcodec/riscv/svqenc_rvv.S +libavcodec/riscv/takdsp_init.c +libavcodec/riscv/takdsp_rvv.S +libavcodec/riscv/utvideodsp_init.c +libavcodec/riscv/utvideodsp_rvv.S +libavcodec/riscv/vc1dsp_init.c +libavcodec/riscv/vc1dsp_rvv.S libavcodec/riscv/vorbisdsp_init.c libavcodec/riscv/vorbisdsp_rvv.S +libavcodec/riscv/vp8dsp_init.c +libavcodec/riscv/vp8dsp_rvv.S libavcodec/rka.c libavcodec/rl.c libavcodec/rl.h @@ -1542,7 +1612,6 @@ libavcodec/sbrdsp.h libavcodec/sbrdsp_template.c libavcodec/screenpresso.c libavcodec/sei.h -libavcodec/setts_bsf.c libavcodec/sgi.h libavcodec/sgidec.c libavcodec/sgienc.c @@ -1632,8 +1701,6 @@ libavcodec/to_upper4.c libavcodec/to_upper4.h libavcodec/tpeldsp.c libavcodec/tpeldsp.h -libavcodec/trace_headers_bsf.c -libavcodec/truehd_core_bsf.c libavcodec/truemotion1.c libavcodec/truemotion1data.h libavcodec/truemotion2.c @@ -1786,11 +1853,7 @@ libavcodec/vp8dsp.h libavcodec/vp9.c libavcodec/vp9.h libavcodec/vp9_mc_template.c -libavcodec/vp9_metadata_bsf.c libavcodec/vp9_parser.c -libavcodec/vp9_raw_reorder_bsf.c -libavcodec/vp9_superframe_bsf.c -libavcodec/vp9_superframe_split_bsf.c libavcodec/vp9block.c libavcodec/vp9data.c libavcodec/vp9data.h @@ -1816,11 +1879,40 @@ libavcodec/vulkan_av1.c libavcodec/vulkan_decode.c libavcodec/vulkan_decode.h libavcodec/vulkan_video.c -libavcodec/vulkan_video_codec_av1std_decode_mesa.h -libavcodec/vulkan_video_codec_av1std_mesa.h libavcodec/vulkan_video.h libavcodec/vvc.h -libavcodec/vvc_mp4toannexb_bsf.c +libavcodec/vvc/Makefile +libavcodec/vvc/vvc_cabac.c +libavcodec/vvc/vvc_cabac.h +libavcodec/vvc/vvc_ctu.c +libavcodec/vvc/vvc_ctu.h +libavcodec/vvc/vvc_data.c +libavcodec/vvc/vvc_data.h +libavcodec/vvc/vvc_filter.c +libavcodec/vvc/vvc_filter.h +libavcodec/vvc/vvc_filter_template.c +libavcodec/vvc/vvc_inter.c +libavcodec/vvc/vvc_inter.h +libavcodec/vvc/vvc_inter_template.c +libavcodec/vvc/vvc_intra.c +libavcodec/vvc/vvc_intra.h +libavcodec/vvc/vvc_intra_template.c +libavcodec/vvc/vvc_intra_utils.c +libavcodec/vvc/vvc_itx_1d.c +libavcodec/vvc/vvc_itx_1d.h +libavcodec/vvc/vvc_mvs.c +libavcodec/vvc/vvc_mvs.h +libavcodec/vvc/vvc_ps.c +libavcodec/vvc/vvc_ps.h +libavcodec/vvc/vvc_refs.c +libavcodec/vvc/vvc_refs.h +libavcodec/vvc/vvc_thread.c +libavcodec/vvc/vvc_thread.h +libavcodec/vvc/vvcdec.c +libavcodec/vvc/vvcdec.h +libavcodec/vvc/vvcdsp.c +libavcodec/vvc/vvcdsp.h +libavcodec/vvc/vvcdsp_template.c libavcodec/vvc_parser.c libavcodec/wavarc.c libavcodec/wavpack.c @@ -1929,6 +2021,9 @@ libavcodec/x86/h264_weight.asm libavcodec/x86/h264_weight_10bit.asm libavcodec/x86/h264chroma_init.c libavcodec/x86/h264dsp_init.c +libavcodec/x86/h26x/h2656_inter.asm +libavcodec/x86/h26x/h2656dsp.c +libavcodec/x86/h26x/h2656dsp.h libavcodec/x86/hpeldsp.asm libavcodec/x86/hpeldsp.h libavcodec/x86/hpeldsp_init.c @@ -2033,6 +2128,9 @@ libavcodec/x86/vp9lpf_16bpp.asm libavcodec/x86/vp9mc.asm libavcodec/x86/vp9mc_16bpp.asm libavcodec/x86/vpx_arith.h +libavcodec/x86/vvc/Makefile +libavcodec/x86/vvc/vvc_mc.asm +libavcodec/x86/vvc/vvcdsp_init.c libavcodec/x86/w64xmmtest.c libavcodec/x86/xvididct.asm libavcodec/x86/xvididct.h @@ -2054,7 +2152,6 @@ libavcodec/xsubdec.c libavcodec/xsubenc.c libavcodec/xvididct.c libavcodec/xvididct.h -libavcodec/xvmc.h libavcodec/xwd.h libavcodec/xwd_parser.c libavcodec/xwddec.c @@ -2123,6 +2220,7 @@ libavdevice/version_major.h libavdevice/xcbgrab.c libavdevice/xv.c libavfilter/Makefile +libavfilter/aap_template.c libavfilter/aarch64/Makefile libavfilter/aarch64/vf_bwdif_init_aarch64.c libavfilter/aarch64/vf_bwdif_neon.S @@ -2130,6 +2228,7 @@ libavfilter/aarch64/vf_nlmeans_init.c libavfilter/aarch64/vf_nlmeans_neon.S libavfilter/adynamicequalizer_template.c libavfilter/aeval.c +libavfilter/af_aap.c libavfilter/af_acontrast.c libavfilter/af_acopy.c libavfilter/af_acrossover.c @@ -2230,6 +2329,8 @@ libavfilter/af_volume.h libavfilter/af_volumedetect.c libavfilter/afir_template.c libavfilter/allfilters.c +libavfilter/anlms_template.c +libavfilter/arls_template.c libavfilter/asink_anullsink.c libavfilter/asrc_afdelaysrc.c libavfilter/asrc_afirsrc.c @@ -2258,6 +2359,7 @@ libavfilter/avf_showvolume.c libavfilter/avf_showwaves.c libavfilter/avfilter.c libavfilter/avfilter.h +libavfilter/avfilter_internal.h libavfilter/avfiltergraph.c libavfilter/bbox.c libavfilter/bbox.h @@ -2282,10 +2384,11 @@ libavfilter/colorspacedsp.h libavfilter/colorspacedsp_template.c libavfilter/colorspacedsp_yuv2yuv_template.c libavfilter/convolution.h -libavfilter/deshake.h +libavfilter/dialoguenhance_template.c libavfilter/dnn/Makefile libavfilter/dnn/dnn_backend_common.c libavfilter/dnn/dnn_backend_common.h +libavfilter/dnn/dnn_backend_torch.cpp libavfilter/dnn/dnn_interface.c libavfilter/dnn/dnn_io_proc.c libavfilter/dnn/dnn_io_proc.h @@ -2323,7 +2426,6 @@ libavfilter/f_streamselect.c libavfilter/f_zmq.c libavfilter/fflcms2.c libavfilter/fflcms2.h -libavfilter/fifo.c libavfilter/filters.h libavfilter/formats.c libavfilter/formats.h @@ -2382,9 +2484,13 @@ libavfilter/psnr.h libavfilter/pthread.c libavfilter/qp_table.c libavfilter/qp_table.h +libavfilter/qrencode.c libavfilter/qsvvpp.c libavfilter/qsvvpp.h libavfilter/removegrain.h +libavfilter/riscv/Makefile +libavfilter/riscv/af_afir_init.c +libavfilter/riscv/af_afir_rvv.S libavfilter/scale_eval.c libavfilter/scale_eval.h libavfilter/scene_sad.c @@ -2401,7 +2507,8 @@ libavfilter/ssim.h libavfilter/stack_internal.c libavfilter/stack_internal.h libavfilter/stereo3d.h -libavfilter/thread.h +libavfilter/textutils.c +libavfilter/textutils.h libavfilter/threshold.h libavfilter/tinterlace.h libavfilter/transform.c @@ -2522,6 +2629,7 @@ libavfilter/vf_freezeframes.c libavfilter/vf_frei0r.c libavfilter/vf_fspp.c libavfilter/vf_fspp.h +libavfilter/vf_fsync.c libavfilter/vf_gblur.c libavfilter/vf_gblur_init.h libavfilter/vf_gblur_vulkan.c @@ -2619,6 +2727,7 @@ libavfilter/vf_psnr.c libavfilter/vf_pullup.c libavfilter/vf_pullup.h libavfilter/vf_qp.c +libavfilter/vf_quirc.c libavfilter/vf_random.c libavfilter/vf_readeia608.c libavfilter/vf_readvitc.c @@ -2666,6 +2775,7 @@ libavfilter/vf_threshold.c libavfilter/vf_threshold_init.h libavfilter/vf_thumbnail.c libavfilter/vf_tile.c +libavfilter/vf_tiltandshift.c libavfilter/vf_tinterlace.c libavfilter/vf_tmidequalizer.c libavfilter/vf_tonemap.c @@ -2824,7 +2934,8 @@ libavformat/adp.c libavformat/ads.c libavformat/adtsenc.c libavformat/adxdec.c -libavformat/aea.c +libavformat/aeadec.c +libavformat/aeaenc.c libavformat/afc.c libavformat/aiff.c libavformat/aiff.h @@ -2892,6 +3003,7 @@ libavformat/bink.c libavformat/binka.c libavformat/bintext.c libavformat/bit.c +libavformat/bitstream.c libavformat/bluray.c libavformat/bmv.c libavformat/boadec.c @@ -2943,6 +3055,9 @@ libavformat/dv.c libavformat/dv.h libavformat/dvbsub.c libavformat/dvbtxt.c +libavformat/dvdclut.c +libavformat/dvdclut.h +libavformat/dvdvideodec.c libavformat/dvenc.c libavformat/dxa.c libavformat/eacdata.c @@ -2955,7 +3070,6 @@ libavformat/ffmeta.h libavformat/ffmetadec.c libavformat/ffmetaenc.c libavformat/fifo.c -libavformat/fifo_test.c libavformat/file.c libavformat/filmstripdec.c libavformat/filmstripenc.c @@ -3014,6 +3128,16 @@ libavformat/http.c libavformat/http.h libavformat/httpauth.c libavformat/httpauth.h +libavformat/iamf.c +libavformat/iamf.h +libavformat/iamf_parse.c +libavformat/iamf_parse.h +libavformat/iamf_reader.c +libavformat/iamf_reader.h +libavformat/iamf_writer.c +libavformat/iamf_writer.h +libavformat/iamfdec.c +libavformat/iamfenc.c libavformat/icecast.c libavformat/icodec.c libavformat/icoenc.c @@ -3203,6 +3327,7 @@ libavformat/psxstr.c libavformat/pva.c libavformat/pvfdec.c libavformat/qcp.c +libavformat/qoadec.c libavformat/qtpalette.c libavformat/qtpalette.h libavformat/r3d.c @@ -3214,6 +3339,7 @@ libavformat/rawenc.h libavformat/rawutils.c libavformat/rawutils.h libavformat/rawvideodec.c +libavformat/rcwtenc.c libavformat/rdt.c libavformat/rdt.h libavformat/realtextdec.c @@ -3416,6 +3542,8 @@ libavformat/vpcc.h libavformat/vpk.c libavformat/vplayerdec.c libavformat/vqf.c +libavformat/vvc.c +libavformat/vvc.h libavformat/vvcdec.c libavformat/w64.c libavformat/w64.h @@ -3579,6 +3707,9 @@ libavutil/hwcontext_cuda.c libavutil/hwcontext_cuda.h libavutil/hwcontext_cuda_internal.h libavutil/hwcontext_d3d11va.h +libavutil/hwcontext_d3d12va.c +libavutil/hwcontext_d3d12va.h +libavutil/hwcontext_d3d12va_internal.h libavutil/hwcontext_drm.c libavutil/hwcontext_drm.h libavutil/hwcontext_dxva2.h @@ -3596,6 +3727,8 @@ libavutil/hwcontext_vdpau.h libavutil/hwcontext_videotoolbox.h libavutil/hwcontext_vulkan.c libavutil/hwcontext_vulkan.h +libavutil/iamf.c +libavutil/iamf.h libavutil/imgutils.c libavutil/imgutils.h libavutil/imgutils_internal.h @@ -3683,6 +3816,7 @@ libavutil/riscv/intmath.h libavutil/riscv/timer.h libavutil/samplefmt.c libavutil/samplefmt.h +libavutil/sfc64.h libavutil/sha.c libavutil/sha.h libavutil/sha512.c @@ -3699,6 +3833,7 @@ libavutil/stereo3d.h libavutil/tablegen.h libavutil/tea.c libavutil/tea.h +libavutil/tests/side_data_array.c libavutil/thread.h libavutil/threadmessage.c libavutil/threadmessage.h @@ -3708,6 +3843,7 @@ libavutil/time_internal.h libavutil/timecode.c libavutil/timecode.h libavutil/timer.h +libavutil/timestamp.c libavutil/timestamp.h libavutil/tree.c libavutil/tree.h @@ -3896,8 +4032,10 @@ presets/libvpx-720p50_60.ffpreset tests/Makefile tests/api/Makefile tests/checkasm/Makefile +tests/checkasm/aacencdsp.c tests/checkasm/aacpsdsp.c tests/checkasm/aarch64/checkasm.S +tests/checkasm/ac3dsp.c tests/checkasm/af_afir.c tests/checkasm/alacdsp.c tests/checkasm/arm/checkasm.S @@ -3916,6 +4054,7 @@ tests/checkasm/g722dsp.c tests/checkasm/huffyuvdsp.c tests/checkasm/idctdsp.c tests/checkasm/jpeg2000dsp.c +tests/checkasm/llauddsp.c tests/checkasm/llviddsp.c tests/checkasm/llviddspenc.c tests/checkasm/lpc.c @@ -3924,10 +4063,12 @@ tests/checkasm/opusdsp.c tests/checkasm/pixblockdsp.c tests/checkasm/riscv/checkasm.S tests/checkasm/sbrdsp.c +tests/checkasm/svq1enc.c tests/checkasm/sw_gbrp.c tests/checkasm/sw_rgb.c tests/checkasm/sw_scale.c tests/checkasm/synth_filter.c +tests/checkasm/takdsp.c tests/checkasm/utvideodsp.c tests/checkasm/v210dec.c tests/checkasm/v210enc.c @@ -3943,6 +4084,7 @@ tests/checkasm/videodsp.c tests/checkasm/vorbisdsp.c tests/checkasm/vp8dsp.c tests/checkasm/vp9dsp.c +tests/checkasm/vvc_mc.c tests/checkasm/x86/checkasm.asm tests/fate/aac.mak tests/fate/ac3.mak @@ -3989,6 +4131,7 @@ tests/fate/hap.mak tests/fate/hevc.mak tests/fate/hlsenc.mak tests/fate/hw.mak +tests/fate/iamf.mak tests/fate/id3v2.mak tests/fate/image.mak tests/fate/imf.mak @@ -4025,6 +4168,7 @@ tests/fate/pixfmt.mak tests/fate/pixlet.mak tests/fate/probe.mak tests/fate/prores.mak +tests/fate/qoa.mak tests/fate/qt.mak tests/fate/qtrle.mak tests/fate/real.mak @@ -4046,10 +4190,21 @@ tests/fate/voice.mak tests/fate/vorbis.mak tests/fate/vpx.mak tests/fate/vqf.mak +tests/fate/vvc.mak tests/fate/wavpack.mak tests/fate/webm-dash-manifest.mak tests/fate/wma.mak tests/fate/xvid.mak +tests/maps/fsync-down +tests/maps/fsync-up +tests/streamgroups/audio_element-5_1_4 +tests/streamgroups/audio_element-7_1_4 +tests/streamgroups/audio_element-ambisonic_1 +tests/streamgroups/audio_element-stereo +tests/streamgroups/mix_presentation-5_1_4 +tests/streamgroups/mix_presentation-7_1_4 +tests/streamgroups/mix_presentation-ambisonic_1 +tests/streamgroups/mix_presentation-stereo tools/Makefile tools/aviocat.c tools/crypto_bench.c @@ -4072,6 +4227,7 @@ tools/seek_print.c tools/sidxindex.c tools/sofa2wavs.c tools/source2c +tools/target_sws_fuzzer.c tools/trasher.c tools/uncoded_frame.c tools/venc_data_dump.c diff --git a/sources b/sources index 03daa05..efd0084 100644 --- a/sources +++ b/sources @@ -1,4 +1,3 @@ -SHA512 (ffmpeg-free-6.1.2.tar.xz) = edaa836c69b0ec2f484a4fd9b49dab97f76e7c6451449f8db8f81f04558974d850b725e3affc36f9790c206a049e42b710f54bb8fd7e4da00ec80ebce6a13e5f -SHA512 (ffmpeg-6.1.2.tar.xz.asc) = a26dba1f4870b964080b45f8468f5ce3591eb6aa69be426bf4afbe5a60c3cbd0fe5056dc86ca7bb817c04ae30d39160cb7773772a9a2123ae7f095b18a6d7050 -SHA512 (ffmpeg-dlopen-headers.tar.xz) = 97e6986fc2bb9dfa4516135a76b04d27ceb52ff96f0af21a6169919aeefefb4d2e2e24a771959689cdbec385f5d71614ba661223c67c0e94089a6dd823a30099 +SHA512 (ffmpeg-free-7.0.2.tar.xz) = d22419888245c19b96679973b25e20d8bd32068fe998383afbd3d9ced4f8b088e743711138c2d034aa7e09b6d206b785b0a6345ca6af8ab28dc9f776619cc346 +SHA512 (ffmpeg-7.0.2.tar.xz.asc) = b41eeb8044754bfcf2cf67a3ed4a4e74194ee6e5f4ed5f03aa03bb68772f6bacd7a1839d8e9740573889230a71d3bc7d52b4625542f4c892e8de8c61deda2c51 SHA512 (ffmpeg.keyring) = 9b36506835db36f776b7ddb53ad6fa9e915e6ca2f9c7cfebe8eb45513e1036a985283590a840ca313a111bf35dc3731f68885aaafb1fb7011ec433cc119e5165 From 9a1dccdbf144bf1542f6c37f5ef58d89c7e31a8d Mon Sep 17 00:00:00 2001 From: Neal Gompa Date: Fri, 20 Sep 2024 13:36:10 -0400 Subject: [PATCH 51/95] Rebuild for newer ffnvcodec --- ffmpeg.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ffmpeg.spec b/ffmpeg.spec index cc08ae6..e5207ca 100644 --- a/ffmpeg.spec +++ b/ffmpeg.spec @@ -91,7 +91,7 @@ Name: ffmpeg %global pkg_name %{name}%{?pkg_suffix} Version: 7.0.2 -Release: 1%{?dist} +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/ @@ -866,6 +866,9 @@ rm -rf %{buildroot}%{_datadir}/%{name}/examples %{_mandir}/man3/libswscale.3* %changelog +* Fri Sep 20 2024 Neal Gompa - 7.0.2-2 +- Rebuild for newer ffnvcodec + * Fri Sep 06 2024 Neal Gompa - 7.0.2-1 - Rebase to 7.0.2 (rhbz#2273572) - Drop OpenH264 dlopen headers as we use noopenh264 now From 4fbec760e3b3f4eec540008883d7738fabbf6516 Mon Sep 17 00:00:00 2001 From: Michel Lind Date: Wed, 25 Sep 2024 16:08:32 -0500 Subject: [PATCH 52/95] Disable omxil completely, it's now retired Rebuild for tesseract-5.4.1-3 (soversion change from 5.4.1 to just 5.4) Signed-off-by: Michel Lind --- ffmpeg.spec | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/ffmpeg.spec b/ffmpeg.spec index e5207ca..f81dd44 100644 --- a/ffmpeg.spec +++ b/ffmpeg.spec @@ -33,7 +33,6 @@ %if 0%{?rhel} # Disable dependencies not offered in RHEL/EPEL -%bcond omxil 0 %else # Disable some features because RHEL 9 packages are too old @@ -47,8 +46,6 @@ %bcond placebo 1 %endif -%bcond omxil 1 - %endif # Break chromaprint dependency cycle (Fedora-only): @@ -184,9 +181,6 @@ BuildRequires: pkgconfig(libchromaprint) BuildRequires: pkgconfig(libdrm) BuildRequires: pkgconfig(libjxl) >= 0.7.0 BuildRequires: pkgconfig(libmodplug) -%if %{with omxil} -BuildRequires: pkgconfig(libomxil-bellagio) -%endif BuildRequires: pkgconfig(libopenjp2) BuildRequires: pkgconfig(libopenmpt) %if %{with placebo} @@ -866,6 +860,10 @@ rm -rf %{buildroot}%{_datadir}/%{name}/examples %{_mandir}/man3/libswscale.3* %changelog +* Wed Sep 25 2024 Michel Lind - 7.0.2-3 +- Disable omxil completely, it's now retired +- Rebuild for tesseract-5.4.1-3 (soversion change from 5.4.1 to just 5.4) + * Fri Sep 20 2024 Neal Gompa - 7.0.2-2 - Rebuild for newer ffnvcodec From 7dc95097f1df2b03487bff7082418781c7d5297d Mon Sep 17 00:00:00 2001 From: Michel Lind Date: Wed, 25 Sep 2024 16:32:18 -0500 Subject: [PATCH 53/95] Bump release Signed-off-by: Michel Lind --- ffmpeg.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ffmpeg.spec b/ffmpeg.spec index f81dd44..872a489 100644 --- a/ffmpeg.spec +++ b/ffmpeg.spec @@ -88,7 +88,7 @@ Name: ffmpeg %global pkg_name %{name}%{?pkg_suffix} Version: 7.0.2 -Release: 2%{?dist} +Release: 3%{?dist} Summary: A complete solution to record, convert and stream audio and video License: GPL-3.0-or-later URL: https://ffmpeg.org/ From a38892833e20f6ca8d6378ad139c58e07c9f0d33 Mon Sep 17 00:00:00 2001 From: Neal Gompa Date: Wed, 2 Oct 2024 04:56:28 -0400 Subject: [PATCH 54/95] Fix chromaprint bcond --- ffmpeg.spec | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/ffmpeg.spec b/ffmpeg.spec index 872a489..fe44857 100644 --- a/ffmpeg.spec +++ b/ffmpeg.spec @@ -2,9 +2,6 @@ %bcond upstream_tarball 0 %bcond all_codecs 0 -# Break dependency cycles by disabling certain optional dependencies. -%bcond bootstrap 0 - # If you want to do a build with the upstream source tarball, then set the # pkg_suffix to %%nil. We can't handle this with a conditional, as srpm # generation would not take it into account. @@ -32,11 +29,16 @@ %endif %if 0%{?rhel} -# Disable dependencies not offered in RHEL/EPEL +# Disable dependencies not available or wanted on RHEL/EPEL +%bcond chromaprint 0 %else +# Break chromaprint dependency cycle (Fedora-only): +# ffmpeg (libavcodec-free) → chromaprint → ffmpeg +%bcond chromaprint %{?_with_bootstrap:0}%{!?_with_bootstrap:1} +%endif -# Disable some features because RHEL 9 packages are too old %if 0%{?rhel} && 0%{?rhel} <= 9 +# Disable some features because RHEL 9 packages are too old %bcond flite 0 %bcond lcms2 0 %bcond placebo 0 @@ -46,17 +48,6 @@ %bcond placebo 1 %endif -%endif - -# Break chromaprint dependency cycle (Fedora-only): -# ffmpeg (libavcodec-free) → chromaprint → ffmpeg -%if %{with bootstrap} -%bcond chromaprint 0 -%else -%bcond chromaprint 1 -%endif - - %if %{with all_codecs} %bcond evc 1 %bcond rtmp 1 @@ -88,7 +79,7 @@ Name: ffmpeg %global pkg_name %{name}%{?pkg_suffix} Version: 7.0.2 -Release: 3%{?dist} +Release: 4%{?dist} Summary: A complete solution to record, convert and stream audio and video License: GPL-3.0-or-later URL: https://ffmpeg.org/ @@ -860,6 +851,9 @@ rm -rf %{buildroot}%{_datadir}/%{name}/examples %{_mandir}/man3/libswscale.3* %changelog +* Wed Oct 02 2024 Neal Gompa - 7.0.2-4 +- Fix chromaprint bcond + * Wed Sep 25 2024 Michel Lind - 7.0.2-3 - Disable omxil completely, it's now retired - Rebuild for tesseract-5.4.1-3 (soversion change from 5.4.1 to just 5.4) From d4e890a117263d9d6837e22f3da77d1815c837d0 Mon Sep 17 00:00:00 2001 From: Neal Gompa Date: Wed, 2 Oct 2024 06:12:29 -0400 Subject: [PATCH 55/95] Restore bootstrap bcond --- ffmpeg.spec | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ffmpeg.spec b/ffmpeg.spec index fe44857..151f499 100644 --- a/ffmpeg.spec +++ b/ffmpeg.spec @@ -2,6 +2,9 @@ %bcond upstream_tarball 0 %bcond all_codecs 0 +# Break dependency cycles by disabling certain optional dependencies. +%bcond bootstrap 0 + # If you want to do a build with the upstream source tarball, then set the # pkg_suffix to %%nil. We can't handle this with a conditional, as srpm # generation would not take it into account. From 24d8902d7505b87c4ef5ffb6f0f706667e347efc Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Mon, 7 Oct 2024 02:01:53 -0400 Subject: [PATCH 56/95] Properly enable noopenh264 Like many options, libopenh264 is disabled if not specified. --- ffmpeg.spec | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ffmpeg.spec b/ffmpeg.spec index 151f499..edbc75f 100644 --- a/ffmpeg.spec +++ b/ffmpeg.spec @@ -82,7 +82,7 @@ Name: ffmpeg %global pkg_name %{name}%{?pkg_suffix} Version: 7.0.2 -Release: 4%{?dist} +Release: 5%{?dist} Summary: A complete solution to record, convert and stream audio and video License: GPL-3.0-or-later URL: https://ffmpeg.org/ @@ -614,6 +614,7 @@ cp -a doc/examples/{*.c,Makefile,README} _doc/examples/ --enable-libmodplug \ --enable-libmp3lame \ --enable-libmysofa \ + --enable-libopenh264 \ --enable-libopenjpeg \ --enable-libopenmpt \ --enable-libopus \ @@ -854,6 +855,9 @@ rm -rf %{buildroot}%{_datadir}/%{name}/examples %{_mandir}/man3/libswscale.3* %changelog +* Mon Oct 07 2024 Yaakov Selkowitz - 7.0.2-5 +- Properly enable noopenh264 + * Wed Oct 02 2024 Neal Gompa - 7.0.2-4 - Fix chromaprint bcond From 8da9f7addec8d44cd6d1a27d69a0a7cdda9a3ca4 Mon Sep 17 00:00:00 2001 From: Neal Gompa Date: Mon, 7 Oct 2024 04:32:18 -0400 Subject: [PATCH 57/95] Enable Kernel Labs VANC processing and ARIB text/caption decoding --- ffmpeg.spec | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/ffmpeg.spec b/ffmpeg.spec index edbc75f..db7dd7b 100644 --- a/ffmpeg.spec +++ b/ffmpeg.spec @@ -82,7 +82,7 @@ Name: ffmpeg %global pkg_name %{name}%{?pkg_suffix} Version: 7.0.2 -Release: 5%{?dist} +Release: 6%{?dist} Summary: A complete solution to record, convert and stream audio and video License: GPL-3.0-or-later URL: https://ffmpeg.org/ @@ -135,6 +135,7 @@ BuildRequires: gsm-devel BuildRequires: ladspa-devel BuildRequires: lame-devel BuildRequires: libgcrypt-devel +BuildRequires: libklvanc-devel BuildRequires: libmysofa-devel BuildRequires: libX11-devel BuildRequires: libXext-devel @@ -144,6 +145,7 @@ BuildRequires: nasm BuildRequires: perl(Pod::Man) BuildRequires: pkgconfig(alsa) BuildRequires: pkgconfig(aom) +BuildRequires: pkgconfig(aribb24) >= 1.0.3 BuildRequires: pkgconfig(bzip2) BuildRequires: pkgconfig(caca) BuildRequires: pkgconfig(codec2) @@ -164,6 +166,7 @@ BuildRequires: pkgconfig(jack) %if %{with lcms2} BuildRequires: pkgconfig(lcms2) >= 2.13 %endif +BuildRequires: pkgconfig(libaribcaption) >= 1.1.1 BuildRequires: pkgconfig(libass) BuildRequires: pkgconfig(libbluray) BuildRequires: pkgconfig(libbs2b) @@ -583,6 +586,8 @@ cp -a doc/examples/{*.c,Makefile,README} _doc/examples/ --enable-vulkan \ --disable-cuda-sdk \ --enable-libaom \ + --enable-libaribb24 \ + --enable-libaribcaption \ --enable-libass \ --enable-libbluray \ --enable-libbs2b \ @@ -611,6 +616,7 @@ cp -a doc/examples/{*.c,Makefile,README} _doc/examples/ --enable-libilbc \ --enable-libjack \ --enable-libjxl \ + --enable-libklvanc \ --enable-libmodplug \ --enable-libmp3lame \ --enable-libmysofa \ @@ -855,6 +861,10 @@ rm -rf %{buildroot}%{_datadir}/%{name}/examples %{_mandir}/man3/libswscale.3* %changelog +* Mon Oct 07 2024 Neal Gompa - 7.0.2-6 +- Enable SDI data processing (Kernel Labs VANC) processing +- Enable Japanese DVD subtitles/teletext (aribb24/libaribcaption) + * Mon Oct 07 2024 Yaakov Selkowitz - 7.0.2-5 - Properly enable noopenh264 From b209e71d90550feac2bf7c7be87bab960a37ba1a Mon Sep 17 00:00:00 2001 From: Nicolas Chauvet Date: Mon, 7 Oct 2024 11:24:28 +0200 Subject: [PATCH 58/95] Disable external schroedinger ffmpeg wrapper code was removed in 3.4, use the internal implemenation nowadays --- ffmpeg.spec | 1 - 1 file changed, 1 deletion(-) diff --git a/ffmpeg.spec b/ffmpeg.spec index db7dd7b..81cc087 100644 --- a/ffmpeg.spec +++ b/ffmpeg.spec @@ -207,7 +207,6 @@ BuildRequires: pkgconfig(openh264) BuildRequires: pkgconfig(opus) BuildRequires: pkgconfig(rav1e) BuildRequires: pkgconfig(rubberband) -BuildRequires: pkgconfig(schroedinger-1.0) BuildRequires: pkgconfig(sdl2) BuildRequires: pkgconfig(shaderc) >= 2019.1 BuildRequires: pkgconfig(smbclient) From aa1f2113d7cc2d393529bccdc090fb5a37f9b89f Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Mon, 7 Oct 2024 11:41:53 -0400 Subject: [PATCH 59/95] Properly enable aribb24/libaribcaption Disable VANC dependency as it depends on decklink --- enable_decoders | 2 ++ ffmpeg.spec | 8 +++++--- ffmpeg_free_sources | 2 ++ sources | 2 +- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/enable_decoders b/enable_decoders index 7b812cc..b7d1602 100644 --- a/enable_decoders +++ b/enable_decoders @@ -194,6 +194,8 @@ jv kgv1 kmvc lagarith +libaribb24 # aribb24 +libaribcaption # libaribcaption libaom # libaom libaom_av1 # libaom libcodec2 # codec2 diff --git a/ffmpeg.spec b/ffmpeg.spec index 81cc087..f213c9e 100644 --- a/ffmpeg.spec +++ b/ffmpeg.spec @@ -82,7 +82,7 @@ Name: ffmpeg %global pkg_name %{name}%{?pkg_suffix} Version: 7.0.2 -Release: 6%{?dist} +Release: 7%{?dist} Summary: A complete solution to record, convert and stream audio and video License: GPL-3.0-or-later URL: https://ffmpeg.org/ @@ -135,7 +135,6 @@ BuildRequires: gsm-devel BuildRequires: ladspa-devel BuildRequires: lame-devel BuildRequires: libgcrypt-devel -BuildRequires: libklvanc-devel BuildRequires: libmysofa-devel BuildRequires: libX11-devel BuildRequires: libXext-devel @@ -615,7 +614,6 @@ cp -a doc/examples/{*.c,Makefile,README} _doc/examples/ --enable-libilbc \ --enable-libjack \ --enable-libjxl \ - --enable-libklvanc \ --enable-libmodplug \ --enable-libmp3lame \ --enable-libmysofa \ @@ -860,6 +858,10 @@ rm -rf %{buildroot}%{_datadir}/%{name}/examples %{_mandir}/man3/libswscale.3* %changelog +* Mon Oct 07 2024 Yaakov Selkowitz - 7.0.2-7 +- Properly enable aribb24/libaribcaption +- Disable VANC dependency as it depends on decklink + * Mon Oct 07 2024 Neal Gompa - 7.0.2-6 - Enable SDI data processing (Kernel Labs VANC) processing - Enable Japanese DVD subtitles/teletext (aribb24/libaribcaption) diff --git a/ffmpeg_free_sources b/ffmpeg_free_sources index 34eb548..7466c32 100644 --- a/ffmpeg_free_sources +++ b/ffmpeg_free_sources @@ -1096,6 +1096,8 @@ libavcodec/lcl.h libavcodec/lcldec.c libavcodec/lclenc.c libavcodec/leb.h +libavcodec/libaribb24.c +libavcodec/libaribcaption.c libavcodec/libaom.c libavcodec/libaom.h libavcodec/libaomdec.c diff --git a/sources b/sources index efd0084..35ed006 100644 --- a/sources +++ b/sources @@ -1,3 +1,3 @@ -SHA512 (ffmpeg-free-7.0.2.tar.xz) = d22419888245c19b96679973b25e20d8bd32068fe998383afbd3d9ced4f8b088e743711138c2d034aa7e09b6d206b785b0a6345ca6af8ab28dc9f776619cc346 +SHA512 (ffmpeg-free-7.0.2.tar.xz) = 062ba768efda367b973250895147efb928f954321ab8a8de395da8b167262cea26cefda186a404e0be9f2080e02f436d2b9c8bf9508cbba0f325a31d697f9a8b SHA512 (ffmpeg-7.0.2.tar.xz.asc) = b41eeb8044754bfcf2cf67a3ed4a4e74194ee6e5f4ed5f03aa03bb68772f6bacd7a1839d8e9740573889230a71d3bc7d52b4625542f4c892e8de8c61deda2c51 SHA512 (ffmpeg.keyring) = 9b36506835db36f776b7ddb53ad6fa9e915e6ca2f9c7cfebe8eb45513e1036a985283590a840ca313a111bf35dc3731f68885aaafb1fb7011ec433cc119e5165 From 4084c1116b09011363e3e3b6f35466019d83eaa6 Mon Sep 17 00:00:00 2001 From: Troy Dawson Date: Mon, 21 Oct 2024 13:42:00 -0700 Subject: [PATCH 60/95] netcdf is no longer used by ffmpeg Signed-off-by: Troy Dawson --- ffmpeg.spec | 1 - 1 file changed, 1 deletion(-) diff --git a/ffmpeg.spec b/ffmpeg.spec index f213c9e..605e292 100644 --- a/ffmpeg.spec +++ b/ffmpeg.spec @@ -197,7 +197,6 @@ BuildRequires: pkgconfig(libxml-2.0) BuildRequires: pkgconfig(libzmq) BuildRequires: pkgconfig(lilv-0) BuildRequires: pkgconfig(lv2) -BuildRequires: pkgconfig(netcdf) BuildRequires: pkgconfig(ogg) BuildRequires: pkgconfig(openal) BuildRequires: pkgconfig(opencore-amrnb) From c17bd62a3271f6c025b7a5733b0e7fc33a23ef36 Mon Sep 17 00:00:00 2001 From: Troy Dawson Date: Mon, 21 Oct 2024 13:43:45 -0700 Subject: [PATCH 61/95] flite will not be in any epel Signed-off-by: Troy Dawson --- ffmpeg.spec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ffmpeg.spec b/ffmpeg.spec index 605e292..5a75c27 100644 --- a/ffmpeg.spec +++ b/ffmpeg.spec @@ -33,8 +33,10 @@ %if 0%{?rhel} # Disable dependencies not available or wanted on RHEL/EPEL +%bcond flite 0 %bcond chromaprint 0 %else +%bcond flite 1 # Break chromaprint dependency cycle (Fedora-only): # ffmpeg (libavcodec-free) → chromaprint → ffmpeg %bcond chromaprint %{?_with_bootstrap:0}%{!?_with_bootstrap:1} @@ -42,11 +44,9 @@ %if 0%{?rhel} && 0%{?rhel} <= 9 # Disable some features because RHEL 9 packages are too old -%bcond flite 0 %bcond lcms2 0 %bcond placebo 0 %else -%bcond flite 1 %bcond lcms2 1 %bcond placebo 1 %endif From cd3c894a26fb860b669fadf06fc47c6557e9dd1c Mon Sep 17 00:00:00 2001 From: Troy Dawson Date: Tue, 29 Oct 2024 14:52:16 -0700 Subject: [PATCH 62/95] Alphabetize conditionals Signed-off-by: Troy Dawson --- ffmpeg.spec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ffmpeg.spec b/ffmpeg.spec index 5a75c27..1bfb40b 100644 --- a/ffmpeg.spec +++ b/ffmpeg.spec @@ -33,13 +33,13 @@ %if 0%{?rhel} # Disable dependencies not available or wanted on RHEL/EPEL -%bcond flite 0 %bcond chromaprint 0 +%bcond flite 0 %else -%bcond flite 1 # Break chromaprint dependency cycle (Fedora-only): # ffmpeg (libavcodec-free) → chromaprint → ffmpeg %bcond chromaprint %{?_with_bootstrap:0}%{!?_with_bootstrap:1} +%bcond flite 1 %endif %if 0%{?rhel} && 0%{?rhel} <= 9 From 14a94115d0a89d6eaad4a260437485979fdc402e Mon Sep 17 00:00:00 2001 From: Sandro Mani Date: Tue, 12 Nov 2024 09:17:29 +0100 Subject: [PATCH 63/95] Rebuild (tesseract) --- ffmpeg.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ffmpeg.spec b/ffmpeg.spec index 1bfb40b..816fd89 100644 --- a/ffmpeg.spec +++ b/ffmpeg.spec @@ -82,7 +82,7 @@ Name: ffmpeg %global pkg_name %{name}%{?pkg_suffix} Version: 7.0.2 -Release: 7%{?dist} +Release: 8%{?dist} Summary: A complete solution to record, convert and stream audio and video License: GPL-3.0-or-later URL: https://ffmpeg.org/ @@ -857,6 +857,9 @@ rm -rf %{buildroot}%{_datadir}/%{name}/examples %{_mandir}/man3/libswscale.3* %changelog +* Tue Nov 12 2024 Sandro Mani - 7.0.2-8 +- Rebuild (tesseract) + * Mon Oct 07 2024 Yaakov Selkowitz - 7.0.2-7 - Properly enable aribb24/libaribcaption - Disable VANC dependency as it depends on decklink From 21b854f6b9364fd9dc56521690d7002c4378cbc4 Mon Sep 17 00:00:00 2001 From: Michel Lind Date: Thu, 9 Jan 2025 12:27:07 -0600 Subject: [PATCH 64/95] Rebuilt for rubberband 4 Signed-off-by: Michel Lind --- ffmpeg.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ffmpeg.spec b/ffmpeg.spec index 816fd89..f29c6d7 100644 --- a/ffmpeg.spec +++ b/ffmpeg.spec @@ -82,7 +82,7 @@ Name: ffmpeg %global pkg_name %{name}%{?pkg_suffix} Version: 7.0.2 -Release: 8%{?dist} +Release: 9%{?dist} Summary: A complete solution to record, convert and stream audio and video License: GPL-3.0-or-later URL: https://ffmpeg.org/ @@ -857,6 +857,9 @@ rm -rf %{buildroot}%{_datadir}/%{name}/examples %{_mandir}/man3/libswscale.3* %changelog +* Thu Jan 09 2025 Michel Lind - 7.0.2-9 +- Rebuilt for rubberband 4 + * Tue Nov 12 2024 Sandro Mani - 7.0.2-8 - Rebuild (tesseract) From 132d2896b6fc4d11c767be1347a18b3be135e5bb Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 16 Jan 2025 18:12:53 +0000 Subject: [PATCH 65/95] Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild --- ffmpeg.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ffmpeg.spec b/ffmpeg.spec index f29c6d7..d37c899 100644 --- a/ffmpeg.spec +++ b/ffmpeg.spec @@ -82,7 +82,7 @@ Name: ffmpeg %global pkg_name %{name}%{?pkg_suffix} Version: 7.0.2 -Release: 9%{?dist} +Release: 10%{?dist} Summary: A complete solution to record, convert and stream audio and video License: GPL-3.0-or-later URL: https://ffmpeg.org/ @@ -857,6 +857,9 @@ rm -rf %{buildroot}%{_datadir}/%{name}/examples %{_mandir}/man3/libswscale.3* %changelog +* Thu Jan 16 2025 Fedora Release Engineering - 7.0.2-10 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild + * Thu Jan 09 2025 Michel Lind - 7.0.2-9 - Rebuilt for rubberband 4 From e02f9b32c25d1c145acbf6f8dc8d81643bb26d17 Mon Sep 17 00:00:00 2001 From: Simone Caronni Date: Wed, 29 Jan 2025 10:58:36 +0100 Subject: [PATCH 66/95] Rebuild for updated VapourSynth --- ffmpeg.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ffmpeg.spec b/ffmpeg.spec index d37c899..ed7e1af 100644 --- a/ffmpeg.spec +++ b/ffmpeg.spec @@ -82,7 +82,7 @@ Name: ffmpeg %global pkg_name %{name}%{?pkg_suffix} Version: 7.0.2 -Release: 10%{?dist} +Release: 11%{?dist} Summary: A complete solution to record, convert and stream audio and video License: GPL-3.0-or-later URL: https://ffmpeg.org/ @@ -857,6 +857,9 @@ rm -rf %{buildroot}%{_datadir}/%{name}/examples %{_mandir}/man3/libswscale.3* %changelog +* Wed Jan 29 2025 Simone Caronni - 7.0.2-11 +- Rebuild for updated VapourSynth. + * Thu Jan 16 2025 Fedora Release Engineering - 7.0.2-10 - Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild From 54e4bc559d6a5af15dc6836d8e5f28393a95aa6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20M=2E=20Basto?= Date: Sun, 2 Feb 2025 19:11:03 +0000 Subject: [PATCH 67/95] Rebuild for jpegxl (libjxl) 0.11.1 --- ffmpeg.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ffmpeg.spec b/ffmpeg.spec index ed7e1af..90af097 100644 --- a/ffmpeg.spec +++ b/ffmpeg.spec @@ -82,7 +82,7 @@ Name: ffmpeg %global pkg_name %{name}%{?pkg_suffix} Version: 7.0.2 -Release: 11%{?dist} +Release: 12%{?dist} Summary: A complete solution to record, convert and stream audio and video License: GPL-3.0-or-later URL: https://ffmpeg.org/ @@ -857,6 +857,9 @@ rm -rf %{buildroot}%{_datadir}/%{name}/examples %{_mandir}/man3/libswscale.3* %changelog +* Sun Feb 02 2025 Sérgio Basto - 7.0.2-12 +- Rebuild for jpegxl (libjxl) 0.11.1 + * Wed Jan 29 2025 Simone Caronni - 7.0.2-11 - Rebuild for updated VapourSynth. From f7cd6c774048d83562d3bef719b1ae02868aefb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert-Andr=C3=A9=20Mauchin?= Date: Wed, 5 Feb 2025 21:34:01 +0100 Subject: [PATCH 68/95] Rebuilt for aom 3.11.0 --- ffmpeg.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ffmpeg.spec b/ffmpeg.spec index 90af097..c265f0b 100644 --- a/ffmpeg.spec +++ b/ffmpeg.spec @@ -82,7 +82,7 @@ Name: ffmpeg %global pkg_name %{name}%{?pkg_suffix} Version: 7.0.2 -Release: 12%{?dist} +Release: 13%{?dist} Summary: A complete solution to record, convert and stream audio and video License: GPL-3.0-or-later URL: https://ffmpeg.org/ @@ -857,6 +857,9 @@ rm -rf %{buildroot}%{_datadir}/%{name}/examples %{_mandir}/man3/libswscale.3* %changelog +* Wed Feb 05 2025 Robert-André Mauchin - 7.0.2-13 +- Rebuilt for aom 3.11.0 + * Sun Feb 02 2025 Sérgio Basto - 7.0.2-12 - Rebuild for jpegxl (libjxl) 0.11.1 From d2ef10fe0c3d209e1245258fb340cf9880623fa7 Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Fri, 7 Feb 2025 13:50:29 -0500 Subject: [PATCH 69/95] Rebase to 7.1 (rhbz#2273572) --- ...e-Make-it-possible-to-send-multiple-.patch | 137 ----------- ...void-sending-the-same-slice-buffer-m.patch | 112 --------- ffmpeg-chromium.patch | 6 +- ffmpeg.spec | 10 +- ffmpeg_free_sources | 223 +++++++++++------- sources | 4 +- 6 files changed, 147 insertions(+), 345 deletions(-) delete mode 100644 0001-lavc-vaapi_decode-Make-it-possible-to-send-multiple-.patch delete mode 100644 0002-lavc-vaapi_av1-Avoid-sending-the-same-slice-buffer-m.patch diff --git a/0001-lavc-vaapi_decode-Make-it-possible-to-send-multiple-.patch b/0001-lavc-vaapi_decode-Make-it-possible-to-send-multiple-.patch deleted file mode 100644 index 34bca43..0000000 --- a/0001-lavc-vaapi_decode-Make-it-possible-to-send-multiple-.patch +++ /dev/null @@ -1,137 +0,0 @@ -From 5176821735c397de2a108cd266a6c6759a5e0ffe Mon Sep 17 00:00:00 2001 -From: David Rosca -Date: Wed, 8 May 2024 09:11:11 +0200 -Subject: [PATCH 1/2] lavc/vaapi_decode: Make it possible to send multiple - slice params buffers - -Reviewed-by: Neal Gompa -Signed-off-by: David Rosca -Signed-off-by: Haihao Xiang -(cherry picked from commit fe9d889dcd79ea18d4dfaa39df4ddbd4c8c3b15c) - -[modified to drop h264/hevc/vc1 parts stripped in Fedora Linux] ---- - libavcodec/vaapi_av1.c | 2 +- - libavcodec/vaapi_decode.c | 3 ++- - libavcodec/vaapi_decode.h | 1 + - libavcodec/vaapi_mjpeg.c | 2 +- - libavcodec/vaapi_mpeg2.c | 2 +- - libavcodec/vaapi_mpeg4.c | 2 +- - libavcodec/vaapi_vp8.c | 2 +- - libavcodec/vaapi_vp9.c | 2 +- - 8 files changed, 9 insertions(+), 7 deletions(-) - -diff --git a/libavcodec/vaapi_av1.c b/libavcodec/vaapi_av1.c -index 1f9a6071ba..03771dd3e0 100644 ---- a/libavcodec/vaapi_av1.c -+++ b/libavcodec/vaapi_av1.c -@@ -409,7 +409,7 @@ static int vaapi_av1_decode_slice(AVCodecContext *avctx, - .tg_end = s->tg_end, - }; - -- err = ff_vaapi_decode_make_slice_buffer(avctx, pic, &slice_param, -+ err = ff_vaapi_decode_make_slice_buffer(avctx, pic, &slice_param, 1, - sizeof(VASliceParameterBufferAV1), - buffer, - size); -diff --git a/libavcodec/vaapi_decode.c b/libavcodec/vaapi_decode.c -index ceac769c52..9344c21fd2 100644 ---- a/libavcodec/vaapi_decode.c -+++ b/libavcodec/vaapi_decode.c -@@ -62,6 +62,7 @@ int ff_vaapi_decode_make_param_buffer(AVCodecContext *avctx, - int ff_vaapi_decode_make_slice_buffer(AVCodecContext *avctx, - VAAPIDecodePicture *pic, - const void *params_data, -+ int nb_params, - size_t params_size, - const void *slice_data, - size_t slice_size) -@@ -90,7 +91,7 @@ int ff_vaapi_decode_make_slice_buffer(AVCodecContext *avctx, - - vas = vaCreateBuffer(ctx->hwctx->display, ctx->va_context, - VASliceParameterBufferType, -- params_size, 1, (void*)params_data, -+ params_size, nb_params, (void*)params_data, - &pic->slice_buffers[index]); - if (vas != VA_STATUS_SUCCESS) { - av_log(avctx, AV_LOG_ERROR, "Failed to create slice " -diff --git a/libavcodec/vaapi_decode.h b/libavcodec/vaapi_decode.h -index 6beda14e52..702171e108 100644 ---- a/libavcodec/vaapi_decode.h -+++ b/libavcodec/vaapi_decode.h -@@ -73,6 +73,7 @@ int ff_vaapi_decode_make_param_buffer(AVCodecContext *avctx, - int ff_vaapi_decode_make_slice_buffer(AVCodecContext *avctx, - VAAPIDecodePicture *pic, - const void *params_data, -+ int nb_params, - size_t params_size, - const void *slice_data, - size_t slice_size); -diff --git a/libavcodec/vaapi_mjpeg.c b/libavcodec/vaapi_mjpeg.c -index 5b8d47bb2a..9557cf5f9b 100644 ---- a/libavcodec/vaapi_mjpeg.c -+++ b/libavcodec/vaapi_mjpeg.c -@@ -131,7 +131,7 @@ static int vaapi_mjpeg_decode_slice(AVCodecContext *avctx, - sp.components[i].ac_table_selector = s->ac_index[i]; - } - -- err = ff_vaapi_decode_make_slice_buffer(avctx, pic, &sp, sizeof(sp), buffer, size); -+ err = ff_vaapi_decode_make_slice_buffer(avctx, pic, &sp, 1, sizeof(sp), buffer, size); - if (err) - goto fail; - -diff --git a/libavcodec/vaapi_mpeg2.c b/libavcodec/vaapi_mpeg2.c -index eeb4e87321..171a742c7f 100644 ---- a/libavcodec/vaapi_mpeg2.c -+++ b/libavcodec/vaapi_mpeg2.c -@@ -162,7 +162,7 @@ static int vaapi_mpeg2_decode_slice(AVCodecContext *avctx, const uint8_t *buffer - }; - - err = ff_vaapi_decode_make_slice_buffer(avctx, pic, -- &slice_param, sizeof(slice_param), -+ &slice_param, 1, sizeof(slice_param), - buffer, size); - if (err < 0) { - ff_vaapi_decode_cancel(avctx, pic); -diff --git a/libavcodec/vaapi_mpeg4.c b/libavcodec/vaapi_mpeg4.c -index 363b686e42..612de10cd7 100644 ---- a/libavcodec/vaapi_mpeg4.c -+++ b/libavcodec/vaapi_mpeg4.c -@@ -169,7 +169,7 @@ static int vaapi_mpeg4_decode_slice(AVCodecContext *avctx, const uint8_t *buffer - }; - - err = ff_vaapi_decode_make_slice_buffer(avctx, pic, -- &slice_param, sizeof(slice_param), -+ &slice_param, 1, sizeof(slice_param), - buffer, size); - if (err < 0) { - ff_vaapi_decode_cancel(avctx, pic); -diff --git a/libavcodec/vaapi_vp8.c b/libavcodec/vaapi_vp8.c -index 31137a45bd..66fdde1f39 100644 ---- a/libavcodec/vaapi_vp8.c -+++ b/libavcodec/vaapi_vp8.c -@@ -209,7 +209,7 @@ static int vaapi_vp8_decode_slice(AVCodecContext *avctx, - for (i = 0; i < 8; i++) - sp.partition_size[i+1] = s->coeff_partition_size[i]; - -- err = ff_vaapi_decode_make_slice_buffer(avctx, pic, &sp, sizeof(sp), data, data_size); -+ err = ff_vaapi_decode_make_slice_buffer(avctx, pic, &sp, 1, sizeof(sp), data, data_size); - if (err) - goto fail; - -diff --git a/libavcodec/vaapi_vp9.c b/libavcodec/vaapi_vp9.c -index 9dc7d5e72b..ff11022db7 100644 ---- a/libavcodec/vaapi_vp9.c -+++ b/libavcodec/vaapi_vp9.c -@@ -158,7 +158,7 @@ static int vaapi_vp9_decode_slice(AVCodecContext *avctx, - } - - err = ff_vaapi_decode_make_slice_buffer(avctx, pic, -- &slice_param, sizeof(slice_param), -+ &slice_param, 1, sizeof(slice_param), - buffer, size); - if (err) { - ff_vaapi_decode_cancel(avctx, pic); --- -2.45.1 - diff --git a/0002-lavc-vaapi_av1-Avoid-sending-the-same-slice-buffer-m.patch b/0002-lavc-vaapi_av1-Avoid-sending-the-same-slice-buffer-m.patch deleted file mode 100644 index 91d018a..0000000 --- a/0002-lavc-vaapi_av1-Avoid-sending-the-same-slice-buffer-m.patch +++ /dev/null @@ -1,112 +0,0 @@ -From 1740980b070897fd147b2d1a5259c9d7957d58a8 Mon Sep 17 00:00:00 2001 -From: David Rosca -Date: Wed, 8 May 2024 09:11:13 +0200 -Subject: [PATCH 2/2] lavc/vaapi_av1: Avoid sending the same slice buffer - multiple times - -When there are multiple tiles in one slice buffer, use multiple slice -params to avoid sending the same slice buffer multiple times and thus -increasing the bitstream size the driver will need to upload to hw. - -Reviewed-by: Neal Gompa -Signed-off-by: David Rosca -Signed-off-by: Haihao Xiang -(cherry picked from commit d2d911eb9a2fc6eb8d86b3ae025a56c1a2692fba) ---- - libavcodec/vaapi_av1.c | 47 +++++++++++++++++++++++++++++------------- - 1 file changed, 33 insertions(+), 14 deletions(-) - -diff --git a/libavcodec/vaapi_av1.c b/libavcodec/vaapi_av1.c -index 03771dd3e0..ea8dd4d93d 100644 ---- a/libavcodec/vaapi_av1.c -+++ b/libavcodec/vaapi_av1.c -@@ -19,6 +19,7 @@ - */ - - #include "libavutil/frame.h" -+#include "libavutil/mem.h" - #include "hwaccel_internal.h" - #include "vaapi_decode.h" - #include "internal.h" -@@ -42,6 +43,9 @@ typedef struct VAAPIAV1DecContext { - */ - VAAPIAV1FrameRef ref_tab[AV1_NUM_REF_FRAMES]; - AVFrame *tmp_frame; -+ -+ int nb_slice_params; -+ VASliceParameterBufferAV1 *slice_params; - } VAAPIAV1DecContext; - - static VASurfaceID vaapi_av1_surface_id(AV1Frame *vf) -@@ -97,6 +101,8 @@ static int vaapi_av1_decode_uninit(AVCodecContext *avctx) - for (int i = 0; i < FF_ARRAY_ELEMS(ctx->ref_tab); i++) - av_frame_free(&ctx->ref_tab[i].frame); - -+ av_freep(&ctx->slice_params); -+ - return ff_vaapi_decode_uninit(avctx); - } - -@@ -393,13 +399,24 @@ static int vaapi_av1_decode_slice(AVCodecContext *avctx, - { - const AV1DecContext *s = avctx->priv_data; - VAAPIDecodePicture *pic = s->cur_frame.hwaccel_picture_private; -- VASliceParameterBufferAV1 slice_param; -- int err = 0; -+ VAAPIAV1DecContext *ctx = avctx->internal->hwaccel_priv_data; -+ int err, nb_params; -+ -+ nb_params = s->tg_end - s->tg_start + 1; -+ if (ctx->nb_slice_params < nb_params) { -+ ctx->slice_params = av_realloc_array(ctx->slice_params, -+ nb_params, -+ sizeof(*ctx->slice_params)); -+ if (!ctx->slice_params) { -+ ctx->nb_slice_params = 0; -+ err = AVERROR(ENOMEM); -+ goto fail; -+ } -+ ctx->nb_slice_params = nb_params; -+ } - - for (int i = s->tg_start; i <= s->tg_end; i++) { -- memset(&slice_param, 0, sizeof(VASliceParameterBufferAV1)); -- -- slice_param = (VASliceParameterBufferAV1) { -+ ctx->slice_params[i - s->tg_start] = (VASliceParameterBufferAV1) { - .slice_data_size = s->tile_group_info[i].tile_size, - .slice_data_offset = s->tile_group_info[i].tile_offset, - .slice_data_flag = VA_SLICE_DATA_FLAG_ALL, -@@ -408,18 +425,20 @@ static int vaapi_av1_decode_slice(AVCodecContext *avctx, - .tg_start = s->tg_start, - .tg_end = s->tg_end, - }; -- -- err = ff_vaapi_decode_make_slice_buffer(avctx, pic, &slice_param, 1, -- sizeof(VASliceParameterBufferAV1), -- buffer, -- size); -- if (err) { -- ff_vaapi_decode_cancel(avctx, pic); -- return err; -- } - } - -+ err = ff_vaapi_decode_make_slice_buffer(avctx, pic, ctx->slice_params, nb_params, -+ sizeof(VASliceParameterBufferAV1), -+ buffer, -+ size); -+ if (err) -+ goto fail; -+ - return 0; -+ -+fail: -+ ff_vaapi_decode_cancel(avctx, pic); -+ return err; - } - - const FFHWAccel ff_av1_vaapi_hwaccel = { --- -2.45.1 - diff --git a/ffmpeg-chromium.patch b/ffmpeg-chromium.patch index 2f5877c..9872622 100644 --- a/ffmpeg-chromium.patch +++ b/ffmpeg-chromium.patch @@ -28,9 +28,9 @@ index cf4d68bff9..7d750abf88 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -56,6 +56,13 @@ int ff_unlock_avformat(void) - return ff_mutex_unlock(&avformat_mutex) ? -1 : 0; - } - + * various utility functions for use within FFmpeg + */ + +// Chromium: We use the internal field first_dts vvv +int64_t av_stream_get_first_dts(const AVStream *st) +{ diff --git a/ffmpeg.spec b/ffmpeg.spec index c265f0b..211e001 100644 --- a/ffmpeg.spec +++ b/ffmpeg.spec @@ -81,8 +81,8 @@ Name: ffmpeg %global pkg_name %{name}%{?pkg_suffix} -Version: 7.0.2 -Release: 13%{?dist} +Version: 7.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/ @@ -103,9 +103,6 @@ Patch1: ffmpeg-codec-choice.patch # Allow to build with fdk-aac-free # See https://bugzilla.redhat.com/show_bug.cgi?id=1501522#c112 Patch2: ffmpeg-allow-fdk-aac-free.patch -# Fixes for Mesa 24.0.6+ / 24.1.4+ VA-API -Patch9: 0001-lavc-vaapi_decode-Make-it-possible-to-send-multiple-.patch -Patch10: 0002-lavc-vaapi_av1-Avoid-sending-the-same-slice-buffer-m.patch # Add first_dts getter to libavformat for Chromium # See: https://bugzilla.redhat.com/show_bug.cgi?id=2240127 @@ -857,6 +854,9 @@ rm -rf %{buildroot}%{_datadir}/%{name}/examples %{_mandir}/man3/libswscale.3* %changelog +* Fri Feb 07 2025 Yaakov Selkowitz - 7.1-1 +- Rebase to 7.1 (rhbz#2273572) + * Wed Feb 05 2025 Robert-André Mauchin - 7.0.2-13 - Rebuilt for aom 3.11.0 diff --git a/ffmpeg_free_sources b/ffmpeg_free_sources index 7466c32..bb37e74 100644 --- a/ffmpeg_free_sources +++ b/ffmpeg_free_sources @@ -13,7 +13,6 @@ README.md RELEASE RELEASE_NOTES VERSION -compat/atomics/gcc/stdatomic.h compat/cuda/dynlink_loader.h compat/va_copy.h compat/w32dlfcn.h @@ -26,6 +25,7 @@ doc/bitstream_filters.texi doc/bootstrap.min.css doc/build_system.txt doc/codecs.texi +doc/community.texi doc/decoders.texi doc/default.css doc/demuxers.texi @@ -178,10 +178,23 @@ libavcodec/aac_parser.c libavcodec/aaccoder.c libavcodec/aaccoder_trellis.h libavcodec/aaccoder_twoloop.h -libavcodec/aacdec.c -libavcodec/aacdec.h -libavcodec/aacdec_template.c -libavcodec/aacdectab.h +libavcodec/aac/Makefile +libavcodec/aac/aacdec.c +libavcodec/aac/aacdec_ac.c +libavcodec/aac/aacdec_ac.h +libavcodec/aac/aacdec_dsp_template.c +libavcodec/aac/aacdec.h +libavcodec/aac/aacdec_float.c +libavcodec/aac/aacdec_float_coupling.h +libavcodec/aac/aacdec_float_prediction.h +libavcodec/aac/aacdec_latm.h +libavcodec/aac/aacdec_lpd.c +libavcodec/aac/aacdec_lpd.h +libavcodec/aac/aacdec_proc_template.c +libavcodec/aac/aacdec_tab.c +libavcodec/aac/aacdec_tab.h +libavcodec/aac/aacdec_usac.c +libavcodec/aac/aacdec_usac.h libavcodec/aacenc.c libavcodec/aacenc.h libavcodec/aacenc_is.c @@ -219,7 +232,12 @@ libavcodec/aandcttab.h libavcodec/aarch64/Makefile libavcodec/aarch64/aacpsdsp_init_aarch64.c libavcodec/aarch64/aacpsdsp_neon.S +libavcodec/aarch64/ac3dsp_init_aarch64.c +libavcodec/aarch64/ac3dsp_neon.S libavcodec/aarch64/cabac.h +libavcodec/aarch64/fdct.h +libavcodec/aarch64/fdctdsp_init_aarch64.c +libavcodec/aarch64/fdctdsp_neon.S libavcodec/aarch64/fmtconvert_init.c libavcodec/aarch64/fmtconvert_neon.S libavcodec/aarch64/h264chroma_init_aarch64.c @@ -240,6 +258,8 @@ libavcodec/aarch64/me_cmp_init_aarch64.c libavcodec/aarch64/me_cmp_neon.S libavcodec/aarch64/mpegaudiodsp_init.c libavcodec/aarch64/mpegaudiodsp_neon.S +libavcodec/aarch64/mpegvideoencdsp_init.c +libavcodec/aarch64/mpegvideoencdsp_neon.S libavcodec/aarch64/neon.S libavcodec/aarch64/neontest.c libavcodec/aarch64/opusdsp_init.c @@ -323,7 +343,6 @@ libavcodec/alacenc.c libavcodec/aliaspixdec.c libavcodec/aliaspixenc.c libavcodec/allcodecs.c -libavcodec/alpha/Makefile libavcodec/amfenc.c libavcodec/amfenc.h libavcodec/amfenc_av1.c @@ -511,7 +530,6 @@ libavcodec/avdct.c libavcodec/avdct.h libavcodec/avfft.c libavcodec/avfft.h -libavcodec/avpacket.c libavcodec/avs2.c libavcodec/avs2.h libavcodec/avs2_parser.c @@ -553,6 +571,7 @@ libavcodec/bsf/av1_frame_split.c libavcodec/bsf/av1_metadata.c libavcodec/bsf/chomp.c libavcodec/bsf/dca_core.c +libavcodec/bsf/dovi_rpu.c libavcodec/bsf/dts2pts.c libavcodec/bsf/dump_extradata.c libavcodec/bsf/dv_error_marker.c @@ -743,6 +762,8 @@ libavcodec/dolby_e_parse.c libavcodec/dolby_e_parser.c libavcodec/dovi_rpu.c libavcodec/dovi_rpu.h +libavcodec/dovi_rpudec.c +libavcodec/dovi_rpuenc.c libavcodec/dpcm.c libavcodec/dpx.c libavcodec/dpx_parser.c @@ -970,20 +991,21 @@ libavcodec/hcom.c libavcodec/hdr_parser.c libavcodec/hdrdec.c libavcodec/hdrenc.c -libavcodec/hevc.h -libavcodec/hevc_data.c -libavcodec/hevc_data.h -libavcodec/hevc_parse.c -libavcodec/hevc_parse.h -libavcodec/hevc_parser.c -libavcodec/hevc_ps.c -libavcodec/hevc_ps.h -libavcodec/hevc_ps_enc.c -libavcodec/hevc_sei.c -libavcodec/hevc_sei.h -libavcodec/hevcdec.h -libavcodec/hevcdsp.h -libavcodec/hevcpred.h +libavcodec/hevc/Makefile +libavcodec/hevc/data.c +libavcodec/hevc/data.h +libavcodec/hevc/dsp.h +libavcodec/hevc/hevc.h +libavcodec/hevc/hevcdec.h +libavcodec/hevc/parse.c +libavcodec/hevc/parse.h +libavcodec/hevc/parser.c +libavcodec/hevc/pred.h +libavcodec/hevc/ps.c +libavcodec/hevc/ps.h +libavcodec/hevc/ps_enc.c +libavcodec/hevc/sei.c +libavcodec/hevc/sei.h libavcodec/hnm4video.c libavcodec/hpel_template.c libavcodec/hpeldsp.c @@ -1009,6 +1031,12 @@ libavcodec/huffyuvdsp.h libavcodec/huffyuvenc.c libavcodec/huffyuvencdsp.c libavcodec/huffyuvencdsp.h +libavcodec/hw_base_encode.c +libavcodec/hw_base_encode.h +libavcodec/hw_base_encode_h264.c +libavcodec/hw_base_encode_h264.h +libavcodec/hw_base_encode_h265.c +libavcodec/hw_base_encode_h265.h libavcodec/hwaccel_internal.h libavcodec/hwaccels.h libavcodec/hwconfig.h @@ -1092,6 +1120,8 @@ libavcodec/lagarith.c libavcodec/lagarithrac.c libavcodec/lagarithrac.h libavcodec/latm_parser.c +libavcodec/lcevcdec.c +libavcodec/lcevcdec.h libavcodec/lcl.h libavcodec/lcldec.c libavcodec/lclenc.c @@ -1353,29 +1383,31 @@ libavcodec/on2avcdata.c libavcodec/on2avcdata.h libavcodec/options.c libavcodec/options_table.h -libavcodec/opus.h -libavcodec/opus_celt.c -libavcodec/opus_celt.h -libavcodec/opus_parse.c -libavcodec/opus_parse.h -libavcodec/opus_parser.c -libavcodec/opus_pvq.c -libavcodec/opus_pvq.h -libavcodec/opus_rc.c -libavcodec/opus_rc.h -libavcodec/opus_silk.c -libavcodec/opus_silk.h -libavcodec/opusdec.c -libavcodec/opusdec_celt.c -libavcodec/opusdsp.c -libavcodec/opusdsp.h -libavcodec/opusenc.c -libavcodec/opusenc.h -libavcodec/opusenc_psy.c -libavcodec/opusenc_psy.h -libavcodec/opusenc_utils.h -libavcodec/opustab.c -libavcodec/opustab.h +libavcodec/opus/Makefile +libavcodec/opus/celt.c +libavcodec/opus/celt.h +libavcodec/opus/dec.c +libavcodec/opus/dec_celt.c +libavcodec/opus/dsp.c +libavcodec/opus/dsp.h +libavcodec/opus/enc.c +libavcodec/opus/enc.h +libavcodec/opus/enc_psy.c +libavcodec/opus/enc_psy.h +libavcodec/opus/enc_utils.h +libavcodec/opus/opus.h +libavcodec/opus/parse.c +libavcodec/opus/parse.h +libavcodec/opus/parser.c +libavcodec/opus/pvq.c +libavcodec/opus/pvq.h +libavcodec/opus/rc.c +libavcodec/opus/rc.h +libavcodec/opus/silk.c +libavcodec/opus/silk.h +libavcodec/opus/tab.c +libavcodec/opus/tab.h +libavcodec/packet.c libavcodec/packet.h libavcodec/packet_internal.h libavcodec/paf.h @@ -1443,6 +1475,7 @@ libavcodec/ppc/vp3dsp_altivec.c libavcodec/ppc/vp8dsp_altivec.c libavcodec/profiles.c libavcodec/profiles.h +libavcodec/progressframe.h libavcodec/prosumer.c libavcodec/psd.c libavcodec/psymodel.c @@ -1518,7 +1551,6 @@ libavcodec/riscv/ac3dsp_rvv.S libavcodec/riscv/alacdsp_init.c libavcodec/riscv/alacdsp_rvv.S libavcodec/riscv/audiodsp_init.c -libavcodec/riscv/audiodsp_rvf.S libavcodec/riscv/audiodsp_rvv.S libavcodec/riscv/blockdsp_init.c libavcodec/riscv/blockdsp_rvv.S @@ -1691,6 +1723,8 @@ libavcodec/texturedsp_template.c libavcodec/texturedspenc.c libavcodec/thread.h libavcodec/threadframe.h +libavcodec/threadprogress.c +libavcodec/threadprogress.h libavcodec/tiertexseqv.c libavcodec/tiff.c libavcodec/tiff.h @@ -1880,41 +1914,43 @@ libavcodec/vulkan.h libavcodec/vulkan_av1.c libavcodec/vulkan_decode.c libavcodec/vulkan_decode.h +libavcodec/vulkan_encode.c +libavcodec/vulkan_encode.h libavcodec/vulkan_video.c libavcodec/vulkan_video.h libavcodec/vvc.h libavcodec/vvc/Makefile -libavcodec/vvc/vvc_cabac.c -libavcodec/vvc/vvc_cabac.h -libavcodec/vvc/vvc_ctu.c -libavcodec/vvc/vvc_ctu.h -libavcodec/vvc/vvc_data.c -libavcodec/vvc/vvc_data.h -libavcodec/vvc/vvc_filter.c -libavcodec/vvc/vvc_filter.h -libavcodec/vvc/vvc_filter_template.c -libavcodec/vvc/vvc_inter.c -libavcodec/vvc/vvc_inter.h -libavcodec/vvc/vvc_inter_template.c -libavcodec/vvc/vvc_intra.c -libavcodec/vvc/vvc_intra.h -libavcodec/vvc/vvc_intra_template.c -libavcodec/vvc/vvc_intra_utils.c -libavcodec/vvc/vvc_itx_1d.c -libavcodec/vvc/vvc_itx_1d.h -libavcodec/vvc/vvc_mvs.c -libavcodec/vvc/vvc_mvs.h -libavcodec/vvc/vvc_ps.c -libavcodec/vvc/vvc_ps.h -libavcodec/vvc/vvc_refs.c -libavcodec/vvc/vvc_refs.h -libavcodec/vvc/vvc_thread.c -libavcodec/vvc/vvc_thread.h -libavcodec/vvc/vvcdec.c -libavcodec/vvc/vvcdec.h -libavcodec/vvc/vvcdsp.c -libavcodec/vvc/vvcdsp.h -libavcodec/vvc/vvcdsp_template.c +libavcodec/vvc/cabac.c +libavcodec/vvc/cabac.h +libavcodec/vvc/ctu.c +libavcodec/vvc/ctu.h +libavcodec/vvc/data.c +libavcodec/vvc/data.h +libavcodec/vvc/dec.c +libavcodec/vvc/dec.h +libavcodec/vvc/dsp.c +libavcodec/vvc/dsp.h +libavcodec/vvc/dsp_template.c +libavcodec/vvc/filter.c +libavcodec/vvc/filter.h +libavcodec/vvc/filter_template.c +libavcodec/vvc/inter.c +libavcodec/vvc/inter.h +libavcodec/vvc/inter_template.c +libavcodec/vvc/intra.c +libavcodec/vvc/intra.h +libavcodec/vvc/intra_template.c +libavcodec/vvc/intra_utils.c +libavcodec/vvc/itx_1d.c +libavcodec/vvc/itx_1d.h +libavcodec/vvc/mvs.c +libavcodec/vvc/mvs.h +libavcodec/vvc/ps.c +libavcodec/vvc/ps.h +libavcodec/vvc/refs.c +libavcodec/vvc/refs.h +libavcodec/vvc/thread.c +libavcodec/vvc/thread.h libavcodec/vvc_parser.c libavcodec/wavarc.c libavcodec/wavpack.c @@ -2250,7 +2286,6 @@ libavfilter/af_afade.c libavfilter/af_afftdn.c libavfilter/af_afftfilt.c libavfilter/af_afir.c -libavfilter/af_afir.h libavfilter/af_afirdsp.h libavfilter/af_aformat.c libavfilter/af_afreqshift.c @@ -2446,7 +2481,6 @@ libavfilter/graphdump.c libavfilter/graphparser.c libavfilter/hermite.h libavfilter/hflip.h -libavfilter/internal.h libavfilter/lavfutils.c libavfilter/lavfutils.h libavfilter/libavfilter.v @@ -2480,6 +2514,8 @@ libavfilter/opencl/xfade.cl libavfilter/opencl_source.h libavfilter/palette.c libavfilter/palette.h +libavfilter/perlin.c +libavfilter/perlin.h libavfilter/phase_template.c libavfilter/preserve_color.h libavfilter/psnr.h @@ -2493,6 +2529,7 @@ libavfilter/removegrain.h libavfilter/riscv/Makefile libavfilter/riscv/af_afir_init.c libavfilter/riscv/af_afir_rvv.S +libavfilter/riscv/cpu_common.c libavfilter/scale_eval.c libavfilter/scale_eval.h libavfilter/scene_sad.c @@ -2517,7 +2554,6 @@ libavfilter/transform.c libavfilter/transform.h libavfilter/transpose.h libavfilter/trim.c -libavfilter/unsharp.h libavfilter/v360.h libavfilter/vaapi_vpp.c libavfilter/vaapi_vpp.h @@ -2599,6 +2635,7 @@ libavfilter/vf_dnn_classify.c libavfilter/vf_dnn_detect.c libavfilter/vf_dnn_processing.c libavfilter/vf_drawbox.c +libavfilter/vf_drawbox_vaapi.c libavfilter/vf_drawtext.c libavfilter/vf_edgedetect.c libavfilter/vf_elbg.c @@ -2711,6 +2748,7 @@ libavfilter/vf_overlay_vulkan.c libavfilter/vf_owdenoise.c libavfilter/vf_pad.c libavfilter/vf_pad_opencl.c +libavfilter/vf_pad_vaapi.c libavfilter/vf_palettegen.c libavfilter/vf_paletteuse.c libavfilter/vf_perspective.c @@ -2813,6 +2851,7 @@ libavfilter/vf_xfade.c libavfilter/vf_xfade_opencl.c libavfilter/vf_xfade_vulkan.c libavfilter/vf_xmedian.c +libavfilter/vf_xpsnr.c libavfilter/vf_yadif.c libavfilter/vf_yaepblur.c libavfilter/vf_zoompan.c @@ -2828,6 +2867,7 @@ libavfilter/vsrc_gradients.c libavfilter/vsrc_life.c libavfilter/vsrc_mandelbrot.c libavfilter/vsrc_mptestsrc.c +libavfilter/vsrc_perlin.c libavfilter/vsrc_sierpinski.c libavfilter/vsrc_testsrc.c libavfilter/vsrc_testsrc_vulkan.c @@ -2912,10 +2952,12 @@ libavfilter/x86/vf_v360.asm libavfilter/x86/vf_v360_init.c libavfilter/x86/vf_w3fdif.asm libavfilter/x86/vf_w3fdif_init.c +libavfilter/x86/vf_xpsnr_init.c libavfilter/x86/vf_yadif.asm libavfilter/x86/vf_yadif_init.c libavfilter/x86/yadif-10.asm libavfilter/x86/yadif-16.asm +libavfilter/xpsnr.h libavfilter/yadif.h libavfilter/yadif_common.c libavformat/3dostr.c @@ -3005,7 +3047,6 @@ libavformat/bink.c libavformat/binka.c libavformat/bintext.c libavformat/bit.c -libavformat/bitstream.c libavformat/bluray.c libavformat/bmv.c libavformat/boadec.c @@ -3191,6 +3232,7 @@ libavformat/jvdec.c libavformat/kvag.c libavformat/lafdec.c libavformat/latmenc.c +libavformat/lc3.c libavformat/libamqp.c libavformat/libavformat.v libavformat/libgme.c @@ -3280,6 +3322,8 @@ libavformat/mxf.h libavformat/mxfdec.c libavformat/mxfenc.c libavformat/mxg.c +libavformat/nal.c +libavformat/nal.h libavformat/ncdec.c libavformat/network.c libavformat/network.h @@ -3341,6 +3385,7 @@ libavformat/rawenc.h libavformat/rawutils.c libavformat/rawutils.h libavformat/rawvideodec.c +libavformat/rcwtdec.c libavformat/rcwtenc.c libavformat/rdt.c libavformat/rdt.h @@ -3584,11 +3629,11 @@ libavformat/yuv4mpegenc.c libavutil/Makefile libavutil/aarch64/Makefile libavutil/aarch64/asm.S -libavutil/aarch64/bswap.h libavutil/aarch64/cpu.c libavutil/aarch64/cpu.h libavutil/aarch64/float_dsp_init.c libavutil/aarch64/float_dsp_neon.S +libavutil/aarch64/intreadwrite.h libavutil/aarch64/neontest.h libavutil/aarch64/timer.h libavutil/aarch64/tx_float_init.c @@ -3614,7 +3659,6 @@ libavutil/arm/float_dsp_init_vfp.c libavutil/arm/float_dsp_neon.S libavutil/arm/float_dsp_vfp.S libavutil/arm/intmath.h -libavutil/arm/intreadwrite.h libavutil/arm/neontest.h libavutil/arm/timer.h libavutil/attributes.h @@ -3810,12 +3854,14 @@ libavutil/riscv/bswap.h libavutil/riscv/bswap_rvb.S libavutil/riscv/cpu.c libavutil/riscv/cpu.h +libavutil/riscv/cpu_common.c libavutil/riscv/fixed_dsp_init.c libavutil/riscv/fixed_dsp_rvv.S libavutil/riscv/float_dsp_init.c libavutil/riscv/float_dsp_rvv.S libavutil/riscv/intmath.h -libavutil/riscv/timer.h +libavutil/riscv/lls_init.c +libavutil/riscv/lls_rvv.S libavutil/samplefmt.c libavutil/samplefmt.h libavutil/sfc64.h @@ -3959,11 +4005,14 @@ libswresample/x86/w64xmmtest.c libswscale/Makefile libswscale/aarch64/Makefile libswscale/aarch64/hscale.S +libswscale/aarch64/input.S libswscale/aarch64/output.S +libswscale/aarch64/range_convert_neon.S libswscale/aarch64/rgb2rgb.c libswscale/aarch64/rgb2rgb_neon.S libswscale/aarch64/swscale.c libswscale/aarch64/swscale_unscaled.c +libswscale/aarch64/swscale_unscaled_neon.S libswscale/aarch64/yuv2rgb_neon.S libswscale/alphablend.c libswscale/arm/Makefile @@ -3996,9 +4045,12 @@ libswscale/rgb2rgb.c libswscale/rgb2rgb.h libswscale/rgb2rgb_template.c libswscale/riscv/Makefile -libswscale/riscv/rgb2rgb.c +libswscale/riscv/cpu_common.c +libswscale/riscv/input_rvv.S +libswscale/riscv/range_rvv.S libswscale/riscv/rgb2rgb_rvb.S libswscale/riscv/rgb2rgb_rvv.S +libswscale/riscv/swscale.c libswscale/slice.c libswscale/swscale.c libswscale/swscale.h @@ -4013,8 +4065,8 @@ libswscale/x86/Makefile libswscale/x86/hscale_fast_bilinear_simd.c libswscale/x86/input.asm libswscale/x86/output.asm +libswscale/x86/range_convert.asm libswscale/x86/rgb2rgb.c -libswscale/x86/rgb2rgb_template.c libswscale/x86/rgb_2_rgb.asm libswscale/x86/scale.asm libswscale/x86/scale_avx2.asm @@ -4022,7 +4074,6 @@ libswscale/x86/swscale.c libswscale/x86/swscale_template.c libswscale/x86/w64xmmtest.c libswscale/x86/yuv2rgb.c -libswscale/x86/yuv2rgb_template.c libswscale/x86/yuv2yuvX.asm libswscale/x86/yuv_2_rgb.asm libswscale/yuv2rgb.c diff --git a/sources b/sources index 35ed006..bdd476f 100644 --- a/sources +++ b/sources @@ -1,3 +1,3 @@ -SHA512 (ffmpeg-free-7.0.2.tar.xz) = 062ba768efda367b973250895147efb928f954321ab8a8de395da8b167262cea26cefda186a404e0be9f2080e02f436d2b9c8bf9508cbba0f325a31d697f9a8b -SHA512 (ffmpeg-7.0.2.tar.xz.asc) = b41eeb8044754bfcf2cf67a3ed4a4e74194ee6e5f4ed5f03aa03bb68772f6bacd7a1839d8e9740573889230a71d3bc7d52b4625542f4c892e8de8c61deda2c51 +SHA512 (ffmpeg-free-7.1.tar.xz) = 60da6e583077399c72148ffe49c76f5afa27e6929147e633cfe406d7a349a84b39712f9000b428973b434fc63f0baf1db05e4f23e3e0fe85eb3e0d3cc78632b1 +SHA512 (ffmpeg-7.1.tar.xz.asc) = 063daa6007abb86de454ba61ba47c75d8251fac07e1b2366aab022a7d80d0bb658f678f2ca2f7c422ad3f5d289201509818f312fe81d72a4176954184b5f2fe6 SHA512 (ffmpeg.keyring) = 9b36506835db36f776b7ddb53ad6fa9e915e6ca2f9c7cfebe8eb45513e1036a985283590a840ca313a111bf35dc3731f68885aaafb1fb7011ec433cc119e5165 From 7110fb70e34238fd04094473f84815dc34e35d99 Mon Sep 17 00:00:00 2001 From: Dominik Mierzejewski Date: Fri, 7 Mar 2025 01:55:42 +0100 Subject: [PATCH 70/95] Update to 7.1.1 (resolves rhbz#2349351) - Enable LC3 codec via liblc3 --- enable_decoders | 1 + enable_encoders | 1 + ffmpeg.spec | 8 +++++++- ffmpeg_free_sources | 2 ++ sources | 4 ++-- 5 files changed, 13 insertions(+), 3 deletions(-) diff --git a/enable_decoders b/enable_decoders index b7d1602..32b4668 100644 --- a/enable_decoders +++ b/enable_decoders @@ -204,6 +204,7 @@ libgsm # libgsm libgsm_ms # libgsm libilbc # ilbc libjxl # libjxl +liblc3 # liblc3 libopencore_amrnb # opencore-amr libopencore_amrwb # opencore-amr libopenh264 # openh264_dlopen diff --git a/enable_encoders b/enable_encoders index 810d081..dad1faf 100644 --- a/enable_encoders +++ b/enable_encoders @@ -78,6 +78,7 @@ libgsm # libgsm libgsm_ms # libgsm libilbc # ilbc libjxl # libjxl +liblc3 # liblc3 libmp3lame # lame libopencore_amrnb libopenh264 # openh264_dlopen diff --git a/ffmpeg.spec b/ffmpeg.spec index 211e001..2c64b90 100644 --- a/ffmpeg.spec +++ b/ffmpeg.spec @@ -81,7 +81,7 @@ Name: ffmpeg %global pkg_name %{name}%{?pkg_suffix} -Version: 7.1 +Version: 7.1.1 Release: 1%{?dist} Summary: A complete solution to record, convert and stream audio and video License: GPL-3.0-or-later @@ -159,6 +159,7 @@ BuildRequires: pkgconfig(gnutls) BuildRequires: pkgconfig(harfbuzz) BuildRequires: pkgconfig(libilbc) BuildRequires: pkgconfig(jack) +BuildRequires: pkgconfig(lc3) %if %{with lcms2} BuildRequires: pkgconfig(lcms2) >= 2.13 %endif @@ -610,6 +611,7 @@ cp -a doc/examples/{*.c,Makefile,README} _doc/examples/ --enable-libilbc \ --enable-libjack \ --enable-libjxl \ + --enable-liblc3 \ --enable-libmodplug \ --enable-libmp3lame \ --enable-libmysofa \ @@ -854,6 +856,10 @@ rm -rf %{buildroot}%{_datadir}/%{name}/examples %{_mandir}/man3/libswscale.3* %changelog +* Thu Mar 06 2025 Dominik Mierzejewski - 7.1.1-1 +- Update to 7.1.1 (resolves rhbz#2349351) +- Enable LC3 codec via liblc3 + * Fri Feb 07 2025 Yaakov Selkowitz - 7.1-1 - Rebase to 7.1 (rhbz#2273572) diff --git a/ffmpeg_free_sources b/ffmpeg_free_sources index bb37e74..8eef184 100644 --- a/ffmpeg_free_sources +++ b/ffmpeg_free_sources @@ -1144,6 +1144,8 @@ libavcodec/libjxl.c libavcodec/libjxl.h libavcodec/libjxldec.c libavcodec/libjxlenc.c +libavcodec/liblc3dec.c +libavcodec/liblc3enc.c libavcodec/libmp3lame.c libavcodec/libopencore-amr.c libavcodec/libopenh264.c diff --git a/sources b/sources index bdd476f..692ab6f 100644 --- a/sources +++ b/sources @@ -1,3 +1,3 @@ -SHA512 (ffmpeg-free-7.1.tar.xz) = 60da6e583077399c72148ffe49c76f5afa27e6929147e633cfe406d7a349a84b39712f9000b428973b434fc63f0baf1db05e4f23e3e0fe85eb3e0d3cc78632b1 -SHA512 (ffmpeg-7.1.tar.xz.asc) = 063daa6007abb86de454ba61ba47c75d8251fac07e1b2366aab022a7d80d0bb658f678f2ca2f7c422ad3f5d289201509818f312fe81d72a4176954184b5f2fe6 +SHA512 (ffmpeg-free-7.1.1.tar.xz) = 391d6fa2197857e4d89822c56f4416d1d07bf7810514ef3bdf235c387fdcfde77e8ab71e325f8e49a7a0aa7d3c018e4d8868f6f32b0c8ceac3ffb7314395572b +SHA512 (ffmpeg-7.1.1.tar.xz.asc) = 480846fd939d00f2ea90c0256081519a6996c7a990d0f66444a7ae1bce2e5ad6380f5d751efc9bde18da9c4d34738ade57dd66288b989dfd074c484562e20e75 SHA512 (ffmpeg.keyring) = 9b36506835db36f776b7ddb53ad6fa9e915e6ca2f9c7cfebe8eb45513e1036a985283590a840ca313a111bf35dc3731f68885aaafb1fb7011ec433cc119e5165 From 4d830a4af870c9293ee884a9464b0f7e9b182178 Mon Sep 17 00:00:00 2001 From: Dominik Mierzejewski Date: Fri, 7 Mar 2025 23:15:43 +0100 Subject: [PATCH 71/95] Backport fix for CVE-2025-22921 --- ffmpeg-CVE-2025-22921.patch | 29 +++++++++++++++++++++++++++++ ffmpeg.spec | 4 ++++ 2 files changed, 33 insertions(+) create mode 100644 ffmpeg-CVE-2025-22921.patch diff --git a/ffmpeg-CVE-2025-22921.patch b/ffmpeg-CVE-2025-22921.patch new file mode 100644 index 0000000..3a522c8 --- /dev/null +++ b/ffmpeg-CVE-2025-22921.patch @@ -0,0 +1,29 @@ +From 7f9c7f9849a2155224711f0ff57ecdac6e4bfb57 Mon Sep 17 00:00:00 2001 +From: James Almer +Date: Wed, 1 Jan 2025 23:58:39 -0300 +Subject: [PATCH] avcodec/jpeg2000dec: clear array length when freeing it + +Fixes NULL pointer dereferences. +Fixes ticket #11393. + +Reviewed-by: Michael Niedermayer +Signed-off-by: James Almer +--- + libavcodec/jpeg2000dec.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c +index e5e897a29f..b82d85d5ee 100644 +--- a/libavcodec/jpeg2000dec.c ++++ b/libavcodec/jpeg2000dec.c +@@ -1521,6 +1521,7 @@ static int jpeg2000_decode_packet(Jpeg2000DecoderContext *s, Jpeg2000Tile *tile, + } + } + av_freep(&cblk->lengthinc); ++ cblk->nb_lengthinc = 0; + } + } + // Save state of stream +-- +2.48.1 + diff --git a/ffmpeg.spec b/ffmpeg.spec index 2c64b90..5e016be 100644 --- a/ffmpeg.spec +++ b/ffmpeg.spec @@ -104,6 +104,9 @@ Patch1: ffmpeg-codec-choice.patch # See https://bugzilla.redhat.com/show_bug.cgi?id=1501522#c112 Patch2: ffmpeg-allow-fdk-aac-free.patch +# Backport fix for CVE-2025-22921 +Patch10: https://git.ffmpeg.org/gitweb/ffmpeg.git/patch/7f9c7f9849a2155224711f0ff57ecdac6e4bfb57#/ffmpeg-CVE-2025-22921.patch + # Add first_dts getter to libavformat for Chromium # See: https://bugzilla.redhat.com/show_bug.cgi?id=2240127 # Reference: https://crbug.com/1306560 @@ -859,6 +862,7 @@ rm -rf %{buildroot}%{_datadir}/%{name}/examples * Thu Mar 06 2025 Dominik Mierzejewski - 7.1.1-1 - Update to 7.1.1 (resolves rhbz#2349351) - Enable LC3 codec via liblc3 +- Backport fix for CVE-2025-22921 (resolves rhbz#2346558) * Fri Feb 07 2025 Yaakov Selkowitz - 7.1-1 - Rebase to 7.1 (rhbz#2273572) From 3dcc47c45b93c17837ea246c10ac4c12206b6c59 Mon Sep 17 00:00:00 2001 From: Fabio Valentini Date: Thu, 13 Mar 2025 18:46:52 +0100 Subject: [PATCH 72/95] Rebuild for noopenh264 2.6.0 --- ffmpeg.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ffmpeg.spec b/ffmpeg.spec index 5e016be..5bf0e69 100644 --- a/ffmpeg.spec +++ b/ffmpeg.spec @@ -82,7 +82,7 @@ Name: ffmpeg %global pkg_name %{name}%{?pkg_suffix} Version: 7.1.1 -Release: 1%{?dist} +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/ @@ -859,6 +859,9 @@ rm -rf %{buildroot}%{_datadir}/%{name}/examples %{_mandir}/man3/libswscale.3* %changelog +* Thu Mar 13 2025 Fabio Valentini - 7.1.1-2 +- Rebuild for noopenh264 2.6.0 + * Thu Mar 06 2025 Dominik Mierzejewski - 7.1.1-1 - Update to 7.1.1 (resolves rhbz#2349351) - Enable LC3 codec via liblc3 From d3e50323a84dc815e5bc3d9ac54d7f6fea42e2ca Mon Sep 17 00:00:00 2001 From: Songsong Zhang Date: Sat, 22 Mar 2025 14:05:57 +0800 Subject: [PATCH 73/95] Add missing source files for riscv64 --- ffmpeg.spec | 5 ++++- ffmpeg_free_sources | 55 ++++++++++++++++++++++++++++++++++++--------- sources | 2 +- 3 files changed, 50 insertions(+), 12 deletions(-) diff --git a/ffmpeg.spec b/ffmpeg.spec index 5bf0e69..d2a1fae 100644 --- a/ffmpeg.spec +++ b/ffmpeg.spec @@ -82,7 +82,7 @@ Name: ffmpeg %global pkg_name %{name}%{?pkg_suffix} Version: 7.1.1 -Release: 2%{?dist} +Release: 3%{?dist} Summary: A complete solution to record, convert and stream audio and video License: GPL-3.0-or-later URL: https://ffmpeg.org/ @@ -859,6 +859,9 @@ rm -rf %{buildroot}%{_datadir}/%{name}/examples %{_mandir}/man3/libswscale.3* %changelog +* Sat Mar 22 2025 Songsong Zhang - 7.1.1-3 +- Add missing source files for riscv64 + * Thu Mar 13 2025 Fabio Valentini - 7.1.1-2 - Rebuild for noopenh264 2.6.0 diff --git a/ffmpeg_free_sources b/ffmpeg_free_sources index 8eef184..38ab19d 100644 --- a/ffmpeg_free_sources +++ b/ffmpeg_free_sources @@ -171,19 +171,12 @@ libavcodec/a64colors.h libavcodec/a64multienc.c libavcodec/a64tables.h libavcodec/aac.h -libavcodec/aac_ac3_parser.c -libavcodec/aac_ac3_parser.h -libavcodec/aac_defines.h -libavcodec/aac_parser.c -libavcodec/aaccoder.c -libavcodec/aaccoder_trellis.h -libavcodec/aaccoder_twoloop.h libavcodec/aac/Makefile libavcodec/aac/aacdec.c +libavcodec/aac/aacdec.h libavcodec/aac/aacdec_ac.c libavcodec/aac/aacdec_ac.h libavcodec/aac/aacdec_dsp_template.c -libavcodec/aac/aacdec.h libavcodec/aac/aacdec_float.c libavcodec/aac/aacdec_float_coupling.h libavcodec/aac/aacdec_float_prediction.h @@ -195,6 +188,13 @@ libavcodec/aac/aacdec_tab.c libavcodec/aac/aacdec_tab.h libavcodec/aac/aacdec_usac.c libavcodec/aac/aacdec_usac.h +libavcodec/aac_ac3_parser.c +libavcodec/aac_ac3_parser.h +libavcodec/aac_defines.h +libavcodec/aac_parser.c +libavcodec/aaccoder.c +libavcodec/aaccoder_trellis.h +libavcodec/aaccoder_twoloop.h libavcodec/aacenc.c libavcodec/aacenc.h libavcodec/aacenc_is.c @@ -1126,12 +1126,12 @@ libavcodec/lcl.h libavcodec/lcldec.c libavcodec/lclenc.c libavcodec/leb.h -libavcodec/libaribb24.c -libavcodec/libaribcaption.c libavcodec/libaom.c libavcodec/libaom.h libavcodec/libaomdec.c libavcodec/libaomenc.c +libavcodec/libaribb24.c +libavcodec/libaribcaption.c libavcodec/libavcodec.v libavcodec/libcodec2.c libavcodec/libdav1d.c @@ -1550,6 +1550,7 @@ libavcodec/riscv/aacpsdsp_rvv.S libavcodec/riscv/ac3dsp_init.c libavcodec/riscv/ac3dsp_rvb.S libavcodec/riscv/ac3dsp_rvv.S +libavcodec/riscv/ac3dsp_rvvb.S libavcodec/riscv/alacdsp_init.c libavcodec/riscv/alacdsp_rvv.S libavcodec/riscv/audiodsp_init.c @@ -1559,16 +1560,25 @@ libavcodec/riscv/blockdsp_rvv.S libavcodec/riscv/bswapdsp_init.c libavcodec/riscv/bswapdsp_rvb.S libavcodec/riscv/bswapdsp_rvv.S +libavcodec/riscv/bswapdsp_rvvb.S +libavcodec/riscv/cpu_common.c libavcodec/riscv/exrdsp_init.c libavcodec/riscv/exrdsp_rvv.S +libavcodec/riscv/fixed_vtype.S libavcodec/riscv/flacdsp_init.c libavcodec/riscv/flacdsp_rvv.S libavcodec/riscv/fmtconvert_init.c libavcodec/riscv/fmtconvert_rvv.S libavcodec/riscv/g722dsp_init.c libavcodec/riscv/g722dsp_rvv.S +libavcodec/riscv/h263dsp_init.c +libavcodec/riscv/h263dsp_rvv.S libavcodec/riscv/h264_chroma_init_riscv.c libavcodec/riscv/h264_mc_chroma.S +libavcodec/riscv/h264addpx_rvv.S +libavcodec/riscv/h264dsp_init.c +libavcodec/riscv/h264dsp_rvv.S +libavcodec/riscv/h264idct_rvv.S libavcodec/riscv/huffyuvdsp_init.c libavcodec/riscv/huffyuvdsp_rvv.S libavcodec/riscv/idctdsp_init.c @@ -1585,13 +1595,21 @@ libavcodec/riscv/lpc_init.c libavcodec/riscv/lpc_rvv.S libavcodec/riscv/me_cmp_init.c libavcodec/riscv/me_cmp_rvv.S +libavcodec/riscv/mpegvideoencdsp_init.c +libavcodec/riscv/mpegvideoencdsp_rvv.S libavcodec/riscv/opusdsp_init.c libavcodec/riscv/opusdsp_rvv.S libavcodec/riscv/pixblockdsp_init.c libavcodec/riscv/pixblockdsp_rvi.S libavcodec/riscv/pixblockdsp_rvv.S +libavcodec/riscv/rv34dsp_init.c +libavcodec/riscv/rv34dsp_rvv.S +libavcodec/riscv/rv40dsp_init.c +libavcodec/riscv/rv40dsp_rvv.S libavcodec/riscv/sbrdsp_init.c libavcodec/riscv/sbrdsp_rvv.S +libavcodec/riscv/startcode_rvb.S +libavcodec/riscv/startcode_rvv.S libavcodec/riscv/svqenc_init.c libavcodec/riscv/svqenc_rvv.S libavcodec/riscv/takdsp_init.c @@ -1599,11 +1617,23 @@ libavcodec/riscv/takdsp_rvv.S libavcodec/riscv/utvideodsp_init.c libavcodec/riscv/utvideodsp_rvv.S libavcodec/riscv/vc1dsp_init.c +libavcodec/riscv/vc1dsp_rvi.S libavcodec/riscv/vc1dsp_rvv.S +libavcodec/riscv/videodsp.S +libavcodec/riscv/videodsp_init.c libavcodec/riscv/vorbisdsp_init.c libavcodec/riscv/vorbisdsp_rvv.S +libavcodec/riscv/vp7dsp_init.c +libavcodec/riscv/vp7dsp_rvv.S +libavcodec/riscv/vp8dsp.h libavcodec/riscv/vp8dsp_init.c +libavcodec/riscv/vp8dsp_rvi.S libavcodec/riscv/vp8dsp_rvv.S +libavcodec/riscv/vp9_intra_rvv.S +libavcodec/riscv/vp9_mc_rvi.S +libavcodec/riscv/vp9_mc_rvv.S +libavcodec/riscv/vp9dsp.h +libavcodec/riscv/vp9dsp_init.c libavcodec/rka.c libavcodec/rl.c libavcodec/rl.h @@ -2245,6 +2275,8 @@ libavdevice/pulse_audio_common.c libavdevice/pulse_audio_common.h libavdevice/pulse_audio_dec.c libavdevice/pulse_audio_enc.c +libavdevice/riscv/Makefile +libavdevice/riscv/cpu_common.c libavdevice/sdl2.c libavdevice/sndio.h libavdevice/timefilter.c @@ -3399,6 +3431,8 @@ libavformat/riff.c libavformat/riff.h libavformat/riffdec.c libavformat/riffenc.c +libavformat/riscv/Makefile +libavformat/riscv/cpu_common.c libavformat/rka.c libavformat/rl2.c libavformat/rm.c @@ -4050,6 +4084,7 @@ libswscale/riscv/Makefile libswscale/riscv/cpu_common.c libswscale/riscv/input_rvv.S libswscale/riscv/range_rvv.S +libswscale/riscv/rgb2rgb.c libswscale/riscv/rgb2rgb_rvb.S libswscale/riscv/rgb2rgb_rvv.S libswscale/riscv/swscale.c diff --git a/sources b/sources index 692ab6f..ed3bf3b 100644 --- a/sources +++ b/sources @@ -1,3 +1,3 @@ -SHA512 (ffmpeg-free-7.1.1.tar.xz) = 391d6fa2197857e4d89822c56f4416d1d07bf7810514ef3bdf235c387fdcfde77e8ab71e325f8e49a7a0aa7d3c018e4d8868f6f32b0c8ceac3ffb7314395572b +SHA512 (ffmpeg-free-7.1.1.tar.xz) = 997e867dd07ac1d228ce20b5c60e6d1a2c3d155b7af381fd0c80b594ccf6f002c7e660f775185be41cf94c8753e74633f99999f6327388f3feb2d8d5aa19dd88 SHA512 (ffmpeg-7.1.1.tar.xz.asc) = 480846fd939d00f2ea90c0256081519a6996c7a990d0f66444a7ae1bce2e5ad6380f5d751efc9bde18da9c4d34738ade57dd66288b989dfd074c484562e20e75 SHA512 (ffmpeg.keyring) = 9b36506835db36f776b7ddb53ad6fa9e915e6ca2f9c7cfebe8eb45513e1036a985283590a840ca313a111bf35dc3731f68885aaafb1fb7011ec433cc119e5165 From 0d0e82fef20595c707cd0a293be0bb36a9b27209 Mon Sep 17 00:00:00 2001 From: Neal Gompa Date: Fri, 13 Jun 2025 04:59:00 -0400 Subject: [PATCH 74/95] Switch to regular upstream sources for package build - Enable more codecs --- README.md | 21 - enable_decoders | 3 + enable_encoders | 4 + ffmpeg.spec | 21 +- ffmpeg_free_sources | 4324 --------------------------------- ffmpeg_gen_free_tarball.sh | 130 - ffmpeg_update_free_sources.sh | 60 - sources | 2 +- 8 files changed, 20 insertions(+), 4545 deletions(-) delete mode 100644 ffmpeg_free_sources delete mode 100755 ffmpeg_gen_free_tarball.sh delete mode 100755 ffmpeg_update_free_sources.sh diff --git a/README.md b/README.md index d42d487..238c0d3 100644 --- a/README.md +++ b/README.md @@ -5,24 +5,3 @@ demux, stream, filter and play pretty much anything that humans and machines have created. It supports the most obscure ancient formats up to the cutting edge. No matter if they were designed by some standards committee, the community or a corporation. - -## Creating the 'free' tarball - -1. Update the `Version` in the spec file. -2. Set the `Release` to 0 in the spec file. -3. Set `pkg_suffix` to `%nil` -4. Do a full build locally: `fedpkg mockbuild --with full_build` -5. Run `./ffmpeg_update_free_sources.sh results_ffmpeg/7.0/0.fc40/build.log` - This will update the `ffmpeg_free_sources` file list. - Note that header files will need to be manually added - to the `ffmpeg_free_sources` file list. -6. Run `./ffmpeg_gen_free_tarball.sh` to create the tarball. -7. Set `pkg_suffix` to `-free` again -8. Set the `Release` to 1 in the spec file. -9. Do a scratch build. - -OR - -1. Edit `ffmpeg_free_sources` and add missing files -2. Run `./ffmpeg_gen_free_tarball.sh` to create the tarball. -3. Do a scratch build. diff --git a/enable_decoders b/enable_decoders index 32b4668..4743afd 100644 --- a/enable_decoders +++ b/enable_decoders @@ -1,4 +1,5 @@ ## 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 @@ -113,6 +114,7 @@ dfa dfpwm dirac # dirac dnxhd +dnxhr dolby_e dpx dsd_lsbf @@ -330,6 +332,7 @@ pictor pjs png # libpng ppm # trivial +prores prosumer psd ptx diff --git a/enable_encoders b/enable_encoders index dad1faf..17b8be3 100644 --- a/enable_encoders +++ b/enable_encoders @@ -38,6 +38,7 @@ cljr dca dfpwm dnxhd +dnxhr dpx dvbsub dvdsub @@ -146,6 +147,9 @@ pgmyuv # trivial phm # trivial png # libpng ppm # trivial +prores +prores_aw +prores_ks qoi qtrle r10k # trivial diff --git a/ffmpeg.spec b/ffmpeg.spec index d2a1fae..4e59df4 100644 --- a/ffmpeg.spec +++ b/ffmpeg.spec @@ -69,6 +69,9 @@ %global _lto_cflags %{nil} %endif +# FIXME: GCC says there's incompatible pointer casts going on in libavdevice... +%global build_type_safety_c 2 + %global av_codec_soversion 61 %global av_device_soversion 61 %global av_filter_soversion 10 @@ -82,21 +85,17 @@ Name: ffmpeg %global pkg_name %{name}%{?pkg_suffix} Version: 7.1.1 -Release: 3%{?dist} +Release: 4%{?dist} Summary: A complete solution to record, convert and stream audio and video License: GPL-3.0-or-later URL: https://ffmpeg.org/ -Source0: ffmpeg%{?pkg_suffix}-%{version}.tar.xz -Source2: https://ffmpeg.org/releases/ffmpeg-%{version}.tar.xz.asc +Source0: https://ffmpeg.org/releases/ffmpeg-%{version}.tar.xz +Source1: https://ffmpeg.org/releases/ffmpeg-%{version}.tar.xz.asc # https://ffmpeg.org/ffmpeg-devel.asc # gpg2 --import --import-options import-export,import-minimal ffmpeg-devel.asc > ./ffmpeg.keyring -Source3: ffmpeg.keyring -Source4: ffmpeg_free_sources +Source2: ffmpeg.keyring Source20: enable_decoders Source21: enable_encoders -# Scripts for generating tarballs -Source90: ffmpeg_update_free_sources.sh -Source91: ffmpeg_gen_free_tarball.sh # Fixes for reduced codec selection on free build Patch1: ffmpeg-codec-choice.patch @@ -532,7 +531,7 @@ This subpackage contains the headers for FFmpeg libswscale. %prep %if %{with upstream_tarball} -%{gpgverify} --keyring='%{SOURCE3}' --signature='%{SOURCE2}' --data='%{SOURCE0}' +%{gpgverify} --keyring='%{SOURCE2}' --signature='%{SOURCE1}' --data='%{SOURCE0}' %endif %autosetup -S git_am @@ -859,6 +858,10 @@ rm -rf %{buildroot}%{_datadir}/%{name}/examples %{_mandir}/man3/libswscale.3* %changelog +* Fri Jun 13 2025 Neal Gompa - 7.1.1-4 +- Switch to regular upstream sources for package build +- Enable more codecs + * Sat Mar 22 2025 Songsong Zhang - 7.1.1-3 - Add missing source files for riscv64 diff --git a/ffmpeg_free_sources b/ffmpeg_free_sources deleted file mode 100644 index 38ab19d..0000000 --- a/ffmpeg_free_sources +++ /dev/null @@ -1,4324 +0,0 @@ -CONTRIBUTING.md -COPYING.GPLv2 -COPYING.GPLv3 -COPYING.LGPLv2.1 -COPYING.LGPLv3 -CREDITS -Changelog -INSTALL.md -LICENSE.md -MAINTAINERS -Makefile -README.md -RELEASE -RELEASE_NOTES -VERSION -compat/cuda/dynlink_loader.h -compat/va_copy.h -compat/w32dlfcn.h -configure -doc/APIchanges -doc/Doxyfile -doc/Makefile -doc/authors.texi -doc/bitstream_filters.texi -doc/bootstrap.min.css -doc/build_system.txt -doc/codecs.texi -doc/community.texi -doc/decoders.texi -doc/default.css -doc/demuxers.texi -doc/developer.texi -doc/devices.texi -doc/doxy-wrapper.sh -doc/encoders.texi -doc/errno.txt -doc/examples/Makefile -doc/examples/Makefile.example -doc/examples/README -doc/examples/avio_http_serve_files.c -doc/examples/avio_list_dir.c -doc/examples/avio_read_callback.c -doc/examples/decode_audio.c -doc/examples/decode_filter_audio.c -doc/examples/decode_filter_video.c -doc/examples/decode_video.c -doc/examples/demux_decode.c -doc/examples/encode_audio.c -doc/examples/encode_video.c -doc/examples/extract_mvs.c -doc/examples/filter_audio.c -doc/examples/hw_decode.c -doc/examples/mux.c -doc/examples/qsv_decode.c -doc/examples/qsv_transcode.c -doc/examples/remux.c -doc/examples/resample_audio.c -doc/examples/scale_video.c -doc/examples/show_metadata.c -doc/examples/transcode.c -doc/examples/transcode_aac.c -doc/examples/vaapi_encode.c -doc/examples/vaapi_transcode.c -doc/faq.texi -doc/fate.texi -doc/fate_config.sh.template -doc/ffmpeg-bitstream-filters.texi -doc/ffmpeg-codecs.texi -doc/ffmpeg-devices.texi -doc/ffmpeg-filters.texi -doc/ffmpeg-formats.texi -doc/ffmpeg-protocols.texi -doc/ffmpeg-resampler.texi -doc/ffmpeg-scaler.texi -doc/ffmpeg-utils.texi -doc/ffmpeg.texi -doc/ffmpeg.txt -doc/ffplay.texi -doc/ffprobe.texi -doc/ffprobe.xsd -doc/fftools-common-opts.texi -doc/filter_design.txt -doc/filters.texi -doc/formats.texi -doc/general.texi -doc/general_contents.texi -doc/git-howto.texi -doc/indevs.texi -doc/infra.txt -doc/issue_tracker.txt -doc/lexicon -doc/libav-merge.txt -doc/libavcodec.texi -doc/libavdevice.texi -doc/libavfilter.texi -doc/libavformat.texi -doc/libavutil.texi -doc/libswresample.texi -doc/libswscale.texi -doc/mailing-list-faq.texi -doc/metadata.texi -doc/mips.txt -doc/multithreading.txt -doc/muxers.texi -doc/nut.texi -doc/optimization.txt -doc/outdevs.texi -doc/patchwork -doc/platform.texi -doc/print_options.c -doc/protocols.texi -doc/rate_distortion.txt -doc/resampler.texi -doc/scaler.texi -doc/snow.txt -doc/style.min.css -doc/swresample.txt -doc/swscale.txt -doc/t2h.init -doc/t2h.pm -doc/tablegen.txt -doc/texi2pod.pl -doc/texidep.pl -doc/transforms.md -doc/undefined.txt -doc/utils.texi -doc/writing_filters.txt -ffbuild/arch.mak -ffbuild/bin2c.c -ffbuild/common.mak -ffbuild/library.mak -ffbuild/libversion.sh -ffbuild/pkgconfig_generate.sh -ffbuild/version.sh -fftools/Makefile -fftools/cmdutils.c -fftools/cmdutils.h -fftools/ffmpeg.c -fftools/ffmpeg.h -fftools/ffmpeg_dec.c -fftools/ffmpeg_demux.c -fftools/ffmpeg_enc.c -fftools/ffmpeg_filter.c -fftools/ffmpeg_hw.c -fftools/ffmpeg_mux.c -fftools/ffmpeg_mux.h -fftools/ffmpeg_mux_init.c -fftools/ffmpeg_opt.c -fftools/ffmpeg_sched.c -fftools/ffmpeg_sched.h -fftools/ffmpeg_utils.h -fftools/ffplay.c -fftools/ffplay_renderer.c -fftools/ffplay_renderer.h -fftools/ffprobe.c -fftools/fopen_utf8.h -fftools/objpool.c -fftools/objpool.h -fftools/opt_common.c -fftools/opt_common.h -fftools/sync_queue.c -fftools/sync_queue.h -fftools/thread_queue.c -fftools/thread_queue.h -libavcodec/012v.c -libavcodec/4xm.c -libavcodec/8bps.c -libavcodec/8svx.c -libavcodec/Makefile -libavcodec/a64colors.h -libavcodec/a64multienc.c -libavcodec/a64tables.h -libavcodec/aac.h -libavcodec/aac/Makefile -libavcodec/aac/aacdec.c -libavcodec/aac/aacdec.h -libavcodec/aac/aacdec_ac.c -libavcodec/aac/aacdec_ac.h -libavcodec/aac/aacdec_dsp_template.c -libavcodec/aac/aacdec_float.c -libavcodec/aac/aacdec_float_coupling.h -libavcodec/aac/aacdec_float_prediction.h -libavcodec/aac/aacdec_latm.h -libavcodec/aac/aacdec_lpd.c -libavcodec/aac/aacdec_lpd.h -libavcodec/aac/aacdec_proc_template.c -libavcodec/aac/aacdec_tab.c -libavcodec/aac/aacdec_tab.h -libavcodec/aac/aacdec_usac.c -libavcodec/aac/aacdec_usac.h -libavcodec/aac_ac3_parser.c -libavcodec/aac_ac3_parser.h -libavcodec/aac_defines.h -libavcodec/aac_parser.c -libavcodec/aaccoder.c -libavcodec/aaccoder_trellis.h -libavcodec/aaccoder_twoloop.h -libavcodec/aacenc.c -libavcodec/aacenc.h -libavcodec/aacenc_is.c -libavcodec/aacenc_is.h -libavcodec/aacenc_ltp.c -libavcodec/aacenc_ltp.h -libavcodec/aacenc_pred.c -libavcodec/aacenc_pred.h -libavcodec/aacenc_quantization.h -libavcodec/aacenc_quantization_misc.h -libavcodec/aacenc_tns.c -libavcodec/aacenc_tns.h -libavcodec/aacenc_utils.h -libavcodec/aacencdsp.h -libavcodec/aacenctab.c -libavcodec/aacenctab.h -libavcodec/aacps.c -libavcodec/aacps.h -libavcodec/aacps_common.c -libavcodec/aacps_float.c -libavcodec/aacps_tablegen.h -libavcodec/aacpsdata.c -libavcodec/aacpsdsp.h -libavcodec/aacpsdsp_float.c -libavcodec/aacpsdsp_template.c -libavcodec/aacpsy.c -libavcodec/aacsbr.c -libavcodec/aacsbr.h -libavcodec/aacsbr_template.c -libavcodec/aacsbrdata.h -libavcodec/aactab.c -libavcodec/aactab.h -libavcodec/aandcttab.c -libavcodec/aandcttab.h -libavcodec/aarch64/Makefile -libavcodec/aarch64/aacpsdsp_init_aarch64.c -libavcodec/aarch64/aacpsdsp_neon.S -libavcodec/aarch64/ac3dsp_init_aarch64.c -libavcodec/aarch64/ac3dsp_neon.S -libavcodec/aarch64/cabac.h -libavcodec/aarch64/fdct.h -libavcodec/aarch64/fdctdsp_init_aarch64.c -libavcodec/aarch64/fdctdsp_neon.S -libavcodec/aarch64/fmtconvert_init.c -libavcodec/aarch64/fmtconvert_neon.S -libavcodec/aarch64/h264chroma_init_aarch64.c -libavcodec/aarch64/h264cmc_neon.S -libavcodec/aarch64/h264dsp_init_aarch64.c -libavcodec/aarch64/h264dsp_neon.S -libavcodec/aarch64/h264idct_neon.S -libavcodec/aarch64/h264pred_init.c -libavcodec/aarch64/h264pred_neon.S -libavcodec/aarch64/h264qpel_init_aarch64.c -libavcodec/aarch64/h264qpel_neon.S -libavcodec/aarch64/hpeldsp_init_aarch64.c -libavcodec/aarch64/hpeldsp_neon.S -libavcodec/aarch64/idct.h -libavcodec/aarch64/idctdsp_init_aarch64.c -libavcodec/aarch64/idctdsp_neon.S -libavcodec/aarch64/me_cmp_init_aarch64.c -libavcodec/aarch64/me_cmp_neon.S -libavcodec/aarch64/mpegaudiodsp_init.c -libavcodec/aarch64/mpegaudiodsp_neon.S -libavcodec/aarch64/mpegvideoencdsp_init.c -libavcodec/aarch64/mpegvideoencdsp_neon.S -libavcodec/aarch64/neon.S -libavcodec/aarch64/neontest.c -libavcodec/aarch64/opusdsp_init.c -libavcodec/aarch64/opusdsp_neon.S -libavcodec/aarch64/pixblockdsp_init_aarch64.c -libavcodec/aarch64/pixblockdsp_neon.S -libavcodec/aarch64/sbrdsp_init_aarch64.c -libavcodec/aarch64/sbrdsp_neon.S -libavcodec/aarch64/simple_idct_neon.S -libavcodec/aarch64/synth_filter_init.c -libavcodec/aarch64/synth_filter_neon.S -libavcodec/aarch64/vc1dsp_init_aarch64.c -libavcodec/aarch64/vc1dsp_neon.S -libavcodec/aarch64/videodsp.S -libavcodec/aarch64/videodsp_init.c -libavcodec/aarch64/vorbisdsp_init.c -libavcodec/aarch64/vorbisdsp_neon.S -libavcodec/aarch64/vp8dsp.h -libavcodec/aarch64/vp8dsp_init_aarch64.c -libavcodec/aarch64/vp8dsp_neon.S -libavcodec/aarch64/vp9dsp_init.h -libavcodec/aarch64/vp9dsp_init_10bpp_aarch64.c -libavcodec/aarch64/vp9dsp_init_12bpp_aarch64.c -libavcodec/aarch64/vp9dsp_init_16bpp_aarch64_template.c -libavcodec/aarch64/vp9dsp_init_aarch64.c -libavcodec/aarch64/vp9itxfm_16bpp_neon.S -libavcodec/aarch64/vp9itxfm_neon.S -libavcodec/aarch64/vp9lpf_16bpp_neon.S -libavcodec/aarch64/vp9lpf_neon.S -libavcodec/aarch64/vp9mc_16bpp_neon.S -libavcodec/aarch64/vp9mc_aarch64.S -libavcodec/aarch64/vp9mc_neon.S -libavcodec/aasc.c -libavcodec/ac3.c -libavcodec/ac3.h -libavcodec/ac3_channel_layout_tab.c -libavcodec/ac3_channel_layout_tab.h -libavcodec/ac3_parser.c -libavcodec/ac3_parser.h -libavcodec/ac3_parser_internal.h -libavcodec/ac3dec.c -libavcodec/ac3dec.h -libavcodec/ac3dec_data.c -libavcodec/ac3dec_data.h -libavcodec/ac3dec_float.c -libavcodec/ac3defs.h -libavcodec/ac3dsp.c -libavcodec/ac3dsp.h -libavcodec/ac3enc.c -libavcodec/ac3enc.h -libavcodec/ac3enc_float.c -libavcodec/ac3enc_template.c -libavcodec/ac3tab.c -libavcodec/ac3tab.h -libavcodec/acelp_filters.c -libavcodec/acelp_filters.h -libavcodec/acelp_pitch_delay.c -libavcodec/acelp_pitch_delay.h -libavcodec/acelp_vectors.c -libavcodec/acelp_vectors.h -libavcodec/adpcm.c -libavcodec/adpcm.h -libavcodec/adpcm_data.c -libavcodec/adpcm_data.h -libavcodec/adpcmenc.c -libavcodec/adts_header.c -libavcodec/adts_header.h -libavcodec/adts_parser.c -libavcodec/adts_parser.h -libavcodec/adx.c -libavcodec/adx.h -libavcodec/adx_parser.c -libavcodec/adxdec.c -libavcodec/adxenc.c -libavcodec/alac.c -libavcodec/alac_data.c -libavcodec/alac_data.h -libavcodec/alacdsp.c -libavcodec/alacdsp.h -libavcodec/alacenc.c -libavcodec/aliaspixdec.c -libavcodec/aliaspixenc.c -libavcodec/allcodecs.c -libavcodec/amfenc.c -libavcodec/amfenc.h -libavcodec/amfenc_av1.c -libavcodec/amfenc_h264.c -libavcodec/amfenc_hevc.c -libavcodec/amr.h -libavcodec/amr_parser.c -libavcodec/amrnbdata.h -libavcodec/amrnbdec.c -libavcodec/amrwbdata.h -libavcodec/amrwbdec.c -libavcodec/anm.c -libavcodec/ansi.c -libavcodec/aom_film_grain.c -libavcodec/aom_film_grain.h -libavcodec/aom_film_grain_template.c -libavcodec/apac.c -libavcodec/apedec.c -libavcodec/apng.h -libavcodec/arbc.c -libavcodec/argo.c -libavcodec/arm/Makefile -libavcodec/arm/aac.h -libavcodec/arm/aacpsdsp_init_arm.c -libavcodec/arm/aacpsdsp_neon.S -libavcodec/arm/ac3dsp_arm.S -libavcodec/arm/ac3dsp_armv6.S -libavcodec/arm/ac3dsp_init_arm.c -libavcodec/arm/ac3dsp_neon.S -libavcodec/arm/asm-offsets.h -libavcodec/arm/audiodsp_arm.h -libavcodec/arm/audiodsp_init_arm.c -libavcodec/arm/audiodsp_init_neon.c -libavcodec/arm/audiodsp_neon.S -libavcodec/arm/blockdsp_arm.h -libavcodec/arm/blockdsp_init_arm.c -libavcodec/arm/blockdsp_init_neon.c -libavcodec/arm/blockdsp_neon.S -libavcodec/arm/cabac.h -libavcodec/arm/dca.h -libavcodec/arm/flacdsp_arm.S -libavcodec/arm/flacdsp_init_arm.c -libavcodec/arm/fmtconvert_init_arm.c -libavcodec/arm/fmtconvert_neon.S -libavcodec/arm/fmtconvert_vfp.S -libavcodec/arm/g722dsp_init_arm.c -libavcodec/arm/g722dsp_neon.S -libavcodec/arm/h264chroma_init_arm.c -libavcodec/arm/h264cmc_neon.S -libavcodec/arm/h264dsp_init_arm.c -libavcodec/arm/h264dsp_neon.S -libavcodec/arm/h264idct_neon.S -libavcodec/arm/h264pred_init_arm.c -libavcodec/arm/h264pred_neon.S -libavcodec/arm/h264qpel_init_arm.c -libavcodec/arm/h264qpel_neon.S -libavcodec/arm/hpeldsp_arm.S -libavcodec/arm/hpeldsp_arm.h -libavcodec/arm/hpeldsp_armv6.S -libavcodec/arm/hpeldsp_init_arm.c -libavcodec/arm/hpeldsp_init_armv6.c -libavcodec/arm/hpeldsp_init_neon.c -libavcodec/arm/hpeldsp_neon.S -libavcodec/arm/idct.h -libavcodec/arm/idctdsp_arm.S -libavcodec/arm/idctdsp_arm.h -libavcodec/arm/idctdsp_armv6.S -libavcodec/arm/idctdsp_init_arm.c -libavcodec/arm/idctdsp_init_armv5te.c -libavcodec/arm/idctdsp_init_armv6.c -libavcodec/arm/idctdsp_init_neon.c -libavcodec/arm/idctdsp_neon.S -libavcodec/arm/int_neon.S -libavcodec/arm/jrevdct_arm.S -libavcodec/arm/lossless_audiodsp_init_arm.c -libavcodec/arm/lossless_audiodsp_neon.S -libavcodec/arm/mathops.h -libavcodec/arm/me_cmp_armv6.S -libavcodec/arm/me_cmp_init_arm.c -libavcodec/arm/mlpdsp_armv5te.S -libavcodec/arm/mlpdsp_armv6.S -libavcodec/arm/mlpdsp_init_arm.c -libavcodec/arm/mpegaudiodsp_fixed_armv6.S -libavcodec/arm/mpegaudiodsp_init_arm.c -libavcodec/arm/mpegvideo_arm.c -libavcodec/arm/mpegvideo_arm.h -libavcodec/arm/mpegvideo_armv5te.c -libavcodec/arm/mpegvideo_armv5te_s.S -libavcodec/arm/mpegvideo_neon.S -libavcodec/arm/mpegvideoencdsp_armv6.S -libavcodec/arm/mpegvideoencdsp_init_arm.c -libavcodec/arm/neon.S -libavcodec/arm/neontest.c -libavcodec/arm/pixblockdsp_armv6.S -libavcodec/arm/pixblockdsp_init_arm.c -libavcodec/arm/pixblockdsp_neon.S -libavcodec/arm/sbcdsp_armv6.S -libavcodec/arm/sbcdsp_init_arm.c -libavcodec/arm/sbcdsp_neon.S -libavcodec/arm/sbrdsp_init_arm.c -libavcodec/arm/sbrdsp_neon.S -libavcodec/arm/simple_idct_arm.S -libavcodec/arm/simple_idct_armv5te.S -libavcodec/arm/simple_idct_armv6.S -libavcodec/arm/simple_idct_neon.S -libavcodec/arm/startcode.h -libavcodec/arm/startcode_armv6.S -libavcodec/arm/synth_filter_init_arm.c -libavcodec/arm/synth_filter_neon.S -libavcodec/arm/synth_filter_vfp.S -libavcodec/arm/vc1dsp.h -libavcodec/arm/vc1dsp_init_arm.c -libavcodec/arm/vc1dsp_init_neon.c -libavcodec/arm/vc1dsp_neon.S -libavcodec/arm/videodsp_arm.h -libavcodec/arm/videodsp_armv5te.S -libavcodec/arm/videodsp_init_arm.c -libavcodec/arm/videodsp_init_armv5te.c -libavcodec/arm/vorbisdsp_init_arm.c -libavcodec/arm/vorbisdsp_neon.S -libavcodec/arm/vp3dsp_init_arm.c -libavcodec/arm/vp3dsp_neon.S -libavcodec/arm/vp6dsp_init_arm.c -libavcodec/arm/vp6dsp_neon.S -libavcodec/arm/vp8.h -libavcodec/arm/vp8_armv6.S -libavcodec/arm/vp8dsp.h -libavcodec/arm/vp8dsp_armv6.S -libavcodec/arm/vp8dsp_init_arm.c -libavcodec/arm/vp8dsp_init_armv6.c -libavcodec/arm/vp8dsp_init_neon.c -libavcodec/arm/vp8dsp_neon.S -libavcodec/arm/vp9dsp_init.h -libavcodec/arm/vp9dsp_init_10bpp_arm.c -libavcodec/arm/vp9dsp_init_12bpp_arm.c -libavcodec/arm/vp9dsp_init_16bpp_arm_template.c -libavcodec/arm/vp9dsp_init_arm.c -libavcodec/arm/vp9itxfm_16bpp_neon.S -libavcodec/arm/vp9itxfm_neon.S -libavcodec/arm/vp9lpf_16bpp_neon.S -libavcodec/arm/vp9lpf_neon.S -libavcodec/arm/vp9mc_16bpp_neon.S -libavcodec/arm/vp9mc_neon.S -libavcodec/arm/vpx_arith.h -libavcodec/ass.c -libavcodec/ass.h -libavcodec/ass_split.c -libavcodec/ass_split.h -libavcodec/assdec.c -libavcodec/assenc.c -libavcodec/asv.c -libavcodec/asv.h -libavcodec/asvdec.c -libavcodec/asvenc.c -libavcodec/atrac.c -libavcodec/atrac.h -libavcodec/atrac1.c -libavcodec/atrac1data.h -libavcodec/atrac3.c -libavcodec/atrac3data.h -libavcodec/atrac3plus.c -libavcodec/atrac3plus.h -libavcodec/atrac3plus_data.h -libavcodec/atrac3plusdec.c -libavcodec/atrac3plusdsp.c -libavcodec/atsc_a53.c -libavcodec/atsc_a53.h -libavcodec/audio_frame_queue.c -libavcodec/audio_frame_queue.h -libavcodec/audiodsp.c -libavcodec/audiodsp.h -libavcodec/aura.c -libavcodec/av1.h -libavcodec/av1_levels.c -libavcodec/av1_levels.h -libavcodec/av1_parse.c -libavcodec/av1_parse.h -libavcodec/av1_parser.c -libavcodec/av1dec.c -libavcodec/av1dec.h -libavcodec/avcodec.c -libavcodec/avcodec.h -libavcodec/avcodec_internal.h -libavcodec/avdct.c -libavcodec/avdct.h -libavcodec/avfft.c -libavcodec/avfft.h -libavcodec/avs2.c -libavcodec/avs2.h -libavcodec/avs2_parser.c -libavcodec/avs3.h -libavcodec/avs3_parser.c -libavcodec/bethsoftvideo.c -libavcodec/bethsoftvideo.h -libavcodec/bfi.c -libavcodec/bink.c -libavcodec/binkaudio.c -libavcodec/binkdata.h -libavcodec/binkdsp.c -libavcodec/binkdsp.h -libavcodec/bintext.c -libavcodec/bintext.h -libavcodec/bit_depth_template.c -libavcodec/bitpacked_dec.c -libavcodec/bitpacked_enc.c -libavcodec/bitstream.c -libavcodec/bitstream.h -libavcodec/bitstream_filters.c -libavcodec/bitstream_template.h -libavcodec/blockdsp.c -libavcodec/blockdsp.h -libavcodec/bmp.c -libavcodec/bmp.h -libavcodec/bmp_parser.c -libavcodec/bmpenc.c -libavcodec/bmvaudio.c -libavcodec/bmvvideo.c -libavcodec/bonk.c -libavcodec/brenderpix.c -libavcodec/bsf.c -libavcodec/bsf.h -libavcodec/bsf/Makefile -libavcodec/bsf/aac_adtstoasc.c -libavcodec/bsf/av1_frame_merge.c -libavcodec/bsf/av1_frame_split.c -libavcodec/bsf/av1_metadata.c -libavcodec/bsf/chomp.c -libavcodec/bsf/dca_core.c -libavcodec/bsf/dovi_rpu.c -libavcodec/bsf/dts2pts.c -libavcodec/bsf/dump_extradata.c -libavcodec/bsf/dv_error_marker.c -libavcodec/bsf/eac3_core.c -libavcodec/bsf/evc_frame_merge.c -libavcodec/bsf/extract_extradata.c -libavcodec/bsf/filter_units.c -libavcodec/bsf/h264_metadata.c -libavcodec/bsf/h264_mp4toannexb.c -libavcodec/bsf/h264_redundant_pps.c -libavcodec/bsf/h265_metadata.c -libavcodec/bsf/h266_metadata.c -libavcodec/bsf/hapqa_extract.c -libavcodec/bsf/hevc_mp4toannexb.c -libavcodec/bsf/imx_dump_header.c -libavcodec/bsf/media100_to_mjpegb.c -libavcodec/bsf/mjpeg2jpeg.c -libavcodec/bsf/mjpega_dump_header.c -libavcodec/bsf/movsub.c -libavcodec/bsf/mpeg2_metadata.c -libavcodec/bsf/mpeg4_unpack_bframes.c -libavcodec/bsf/noise.c -libavcodec/bsf/null.c -libavcodec/bsf/opus_metadata.c -libavcodec/bsf/pcm_rechunk.c -libavcodec/bsf/pgs_frame_merge.c -libavcodec/bsf/prores_metadata.c -libavcodec/bsf/remove_extradata.c -libavcodec/bsf/setts.c -libavcodec/bsf/showinfo.c -libavcodec/bsf/trace_headers.c -libavcodec/bsf/truehd_core.c -libavcodec/bsf/vp9_metadata.c -libavcodec/bsf/vp9_raw_reorder.c -libavcodec/bsf/vp9_superframe.c -libavcodec/bsf/vp9_superframe_split.c -libavcodec/bsf/vvc_mp4toannexb.c -libavcodec/bsf_internal.h -libavcodec/bswapdsp.c -libavcodec/bswapdsp.h -libavcodec/bytestream.h -libavcodec/c93.c -libavcodec/cabac.h -libavcodec/canopus.c -libavcodec/canopus.h -libavcodec/cavs.h -libavcodec/cavs_parser.c -libavcodec/cavsdsp.h -libavcodec/cbrt_data.c -libavcodec/cbrt_data.h -libavcodec/cbrt_tablegen.h -libavcodec/cbs.c -libavcodec/cbs.h -libavcodec/cbs_av1.c -libavcodec/cbs_av1.h -libavcodec/cbs_av1_syntax_template.c -libavcodec/cbs_bsf.c -libavcodec/cbs_bsf.h -libavcodec/cbs_h264.h -libavcodec/cbs_h2645.c -libavcodec/cbs_h2645.h -libavcodec/cbs_h264_syntax_template.c -libavcodec/cbs_h265.h -libavcodec/cbs_h265_syntax_template.c -libavcodec/cbs_h266.h -libavcodec/cbs_h266_syntax_template.c -libavcodec/cbs_internal.h -libavcodec/cbs_jpeg.c -libavcodec/cbs_jpeg.h -libavcodec/cbs_jpeg_syntax_template.c -libavcodec/cbs_mpeg2.c -libavcodec/cbs_mpeg2.h -libavcodec/cbs_mpeg2_syntax_template.c -libavcodec/cbs_sei.c -libavcodec/cbs_sei.h -libavcodec/cbs_sei_syntax_template.c -libavcodec/cbs_vp8.c -libavcodec/cbs_vp8.h -libavcodec/cbs_vp8_syntax_template.c -libavcodec/cbs_vp9.c -libavcodec/cbs_vp9.h -libavcodec/cbs_vp9_syntax_template.c -libavcodec/ccaption_dec.c -libavcodec/cdgraphics.c -libavcodec/cdtoons.c -libavcodec/cdxl.c -libavcodec/celp_filters.c -libavcodec/celp_filters.h -libavcodec/celp_math.c -libavcodec/celp_math.h -libavcodec/cga_data.c -libavcodec/cga_data.h -libavcodec/cinepak.c -libavcodec/cinepakenc.c -libavcodec/clearvideo.c -libavcodec/clearvideodata.h -libavcodec/cljrdec.c -libavcodec/cljrenc.c -libavcodec/codec.h -libavcodec/codec2utils.h -libavcodec/codec_desc.c -libavcodec/codec_desc.h -libavcodec/codec_id.h -libavcodec/codec_internal.h -libavcodec/codec_par.c -libavcodec/codec_par.h -libavcodec/cook.c -libavcodec/cook_parser.c -libavcodec/cookdata.h -libavcodec/copy_block.h -libavcodec/cpia.c -libavcodec/cri_parser.c -libavcodec/cscd.c -libavcodec/cyuv.c -libavcodec/d3d11va.c -libavcodec/d3d11va.h -libavcodec/d3d12va_av1.c -libavcodec/d3d12va_decode.c -libavcodec/d3d12va_decode.h -libavcodec/d3d12va_mpeg2.c -libavcodec/d3d12va_vc1.c -libavcodec/d3d12va_vp9.c -libavcodec/dca.c -libavcodec/dca.h -libavcodec/dca_core.c -libavcodec/dca_core.h -libavcodec/dca_exss.c -libavcodec/dca_exss.h -libavcodec/dca_lbr.c -libavcodec/dca_lbr.h -libavcodec/dca_parser.c -libavcodec/dca_sample_rate_tab.c -libavcodec/dca_sample_rate_tab.h -libavcodec/dca_syncwords.h -libavcodec/dca_xll.c -libavcodec/dca_xll.h -libavcodec/dcaadpcm.c -libavcodec/dcaadpcm.h -libavcodec/dcadata.c -libavcodec/dcadata.h -libavcodec/dcadct.c -libavcodec/dcadct.h -libavcodec/dcadec.c -libavcodec/dcadec.h -libavcodec/dcadsp.c -libavcodec/dcadsp.h -libavcodec/dcaenc.c -libavcodec/dcaenc.h -libavcodec/dcahuff.c -libavcodec/dcahuff.h -libavcodec/dcamath.h -libavcodec/dct.h -libavcodec/dct32.h -libavcodec/dct32_fixed.c -libavcodec/dct32_float.c -libavcodec/dct32_template.c -libavcodec/dds.c -libavcodec/decode.c -libavcodec/decode.h -libavcodec/defs.h -libavcodec/dfa.c -libavcodec/dfpwmdec.c -libavcodec/dfpwmenc.c -libavcodec/dirac.c -libavcodec/dirac.h -libavcodec/dirac_arith.c -libavcodec/dirac_arith.h -libavcodec/dirac_dwt.c -libavcodec/dirac_dwt.h -libavcodec/dirac_dwt_template.c -libavcodec/dirac_parser.c -libavcodec/dirac_vlc.c -libavcodec/dirac_vlc.h -libavcodec/diracdec.c -libavcodec/diracdsp.c -libavcodec/diracdsp.h -libavcodec/diractab.c -libavcodec/diractab.h -libavcodec/dnxhd_parser.c -libavcodec/dnxhddata.c -libavcodec/dnxhddata.h -libavcodec/dnxhddec.c -libavcodec/dnxhdenc.c -libavcodec/dnxhdenc.h -libavcodec/dolby_e.c -libavcodec/dolby_e.h -libavcodec/dolby_e_parse.c -libavcodec/dolby_e_parser.c -libavcodec/dovi_rpu.c -libavcodec/dovi_rpu.h -libavcodec/dovi_rpudec.c -libavcodec/dovi_rpuenc.c -libavcodec/dpcm.c -libavcodec/dpx.c -libavcodec/dpx_parser.c -libavcodec/dpxenc.c -libavcodec/dsd.c -libavcodec/dsd.h -libavcodec/dsddec.c -libavcodec/dsicinaudio.c -libavcodec/dsicinvideo.c -libavcodec/dss_sp.c -libavcodec/dv.c -libavcodec/dv.h -libavcodec/dv_internal.h -libavcodec/dv_profile.c -libavcodec/dv_profile.h -libavcodec/dv_profile_internal.h -libavcodec/dv_tablegen.h -libavcodec/dvaudio.h -libavcodec/dvaudio_parser.c -libavcodec/dvaudiodec.c -libavcodec/dvbsub_parser.c -libavcodec/dvbsubdec.c -libavcodec/dvbsubenc.c -libavcodec/dvbtxt.h -libavcodec/dvd_nav_parser.c -libavcodec/dvdata.c -libavcodec/dvdata.h -libavcodec/dvdec.c -libavcodec/dvdsub.c -libavcodec/dvdsub.h -libavcodec/dvdsub_parser.c -libavcodec/dvdsubdec.c -libavcodec/dvdsubenc.c -libavcodec/dvenc.c -libavcodec/dxa.c -libavcodec/dxtory.c -libavcodec/dxva2.h -libavcodec/dynamic_hdr_vivid.c -libavcodec/dynamic_hdr_vivid.h -libavcodec/eac3_data.h -libavcodec/eac3dec.c -libavcodec/eac3enc.h -libavcodec/eacmv.c -libavcodec/eaidct.c -libavcodec/eaidct.h -libavcodec/eamad.c -libavcodec/eatgq.c -libavcodec/eatgv.c -libavcodec/eatqi.c -libavcodec/elbg.c -libavcodec/elbg.h -libavcodec/encode.c -libavcodec/encode.h -libavcodec/error_resilience.c -libavcodec/error_resilience.h -libavcodec/escape124.c -libavcodec/escape130.c -libavcodec/evc.h -libavcodec/evc_parse.c -libavcodec/evc_parse.h -libavcodec/evc_parser.c -libavcodec/evc_ps.c -libavcodec/evc_ps.h -libavcodec/evrcdata.h -libavcodec/evrcdec.c -libavcodec/exif.c -libavcodec/exif.h -libavcodec/exr.c -libavcodec/exrdsp.c -libavcodec/exrdsp.h -libavcodec/exrenc.c -libavcodec/faandct.c -libavcodec/faandct.h -libavcodec/faanidct.c -libavcodec/faanidct.h -libavcodec/faxcompr.c -libavcodec/faxcompr.h -libavcodec/fdctdsp.c -libavcodec/fdctdsp.h -libavcodec/fflcms2.c -libavcodec/fflcms2.h -libavcodec/ffv1.c -libavcodec/ffv1.h -libavcodec/ffv1_template.c -libavcodec/ffv1dec.c -libavcodec/ffv1dec_template.c -libavcodec/ffv1enc.c -libavcodec/ffv1enc_template.c -libavcodec/ffwavesynth.c -libavcodec/fits.c -libavcodec/fits.h -libavcodec/fitsdec.c -libavcodec/flac.c -libavcodec/flac.h -libavcodec/flac_parse.h -libavcodec/flac_parser.c -libavcodec/flacdata.c -libavcodec/flacdata.h -libavcodec/flacdec.c -libavcodec/flacdsp.c -libavcodec/flacdsp.h -libavcodec/flacdsp_lpc_template.c -libavcodec/flacdsp_template.c -libavcodec/flacenc.c -libavcodec/flacencdsp.c -libavcodec/flacencdsp.h -libavcodec/flashsv.c -libavcodec/flashsv2enc.c -libavcodec/flashsvenc.c -libavcodec/flicvideo.c -libavcodec/float2half.c -libavcodec/flvdec.c -libavcodec/flvdec.h -libavcodec/flvenc.c -libavcodec/flvenc.h -libavcodec/fmtconvert.c -libavcodec/fmtconvert.h -libavcodec/fmvc.c -libavcodec/frame_thread_encoder.c -libavcodec/frame_thread_encoder.h -libavcodec/ftr.c -libavcodec/ftr_parser.c -libavcodec/g722.c -libavcodec/g722.h -libavcodec/g722dec.c -libavcodec/g722dsp.c -libavcodec/g722dsp.h -libavcodec/g722enc.c -libavcodec/g723_1.c -libavcodec/g723_1.h -libavcodec/g723_1_parser.c -libavcodec/g723_1dec.c -libavcodec/g723_1enc.c -libavcodec/g726.c -libavcodec/g729.h -libavcodec/g729_parser.c -libavcodec/g729data.h -libavcodec/g729dec.c -libavcodec/g729postfilter.c -libavcodec/g729postfilter.h -libavcodec/gdv.c -libavcodec/gemdec.c -libavcodec/get_bits.h -libavcodec/get_buffer.c -libavcodec/gif.c -libavcodec/gif.h -libavcodec/gif_parser.c -libavcodec/gifdec.c -libavcodec/golomb.c -libavcodec/golomb.h -libavcodec/gsm.h -libavcodec/gsm_parser.c -libavcodec/gsmdec.c -libavcodec/gsmdec_data.c -libavcodec/gsmdec_data.h -libavcodec/gsmdec_template.c -libavcodec/h261.c -libavcodec/h261.h -libavcodec/h261_parser.c -libavcodec/h261data.c -libavcodec/h261dec.c -libavcodec/h261enc.c -libavcodec/h261enc.h -libavcodec/h263.c -libavcodec/h263.h -libavcodec/h263_parser.c -libavcodec/h263data.c -libavcodec/h263data.h -libavcodec/h263dec.c -libavcodec/h263dec.h -libavcodec/h263dsp.c -libavcodec/h263dsp.h -libavcodec/h263enc.h -libavcodec/h264.h -libavcodec/h2645_parse.c -libavcodec/h2645_parse.h -libavcodec/h2645_sei.c -libavcodec/h2645_sei.h -libavcodec/h2645_vui.c -libavcodec/h2645_vui.h -libavcodec/h2645data.c -libavcodec/h2645data.h -libavcodec/h264_levels.c -libavcodec/h264_levels.h -libavcodec/h264_parse.c -libavcodec/h264_parse.h -libavcodec/h264_parser.c -libavcodec/h264_ps.c -libavcodec/h264_ps.h -libavcodec/h264_sei.c -libavcodec/h264_sei.h -libavcodec/h264addpx_template.c -libavcodec/h264chroma.c -libavcodec/h264chroma.h -libavcodec/h264chroma_template.c -libavcodec/h264data.c -libavcodec/h264data.h -libavcodec/h264dec.h -libavcodec/h264dsp.c -libavcodec/h264dsp.h -libavcodec/h264dsp_template.c -libavcodec/h264idct.c -libavcodec/h264idct.h -libavcodec/h264idct_template.c -libavcodec/h264pred.c -libavcodec/h264pred.h -libavcodec/h264pred_template.c -libavcodec/h264qpel.c -libavcodec/h264qpel.h -libavcodec/h264qpel_template.c -libavcodec/h265_profile_level.c -libavcodec/h265_profile_level.h -libavcodec/h26x/h2656_deblock_template.c -libavcodec/h26x/h2656_inter_template.c -libavcodec/h26x/h2656_sao_template.c -libavcodec/h274.h -libavcodec/half2float.c -libavcodec/hap.c -libavcodec/hap.h -libavcodec/hapdec.c -libavcodec/hapenc.c -libavcodec/hca_data.h -libavcodec/hcadec.c -libavcodec/hcom.c -libavcodec/hdr_parser.c -libavcodec/hdrdec.c -libavcodec/hdrenc.c -libavcodec/hevc/Makefile -libavcodec/hevc/data.c -libavcodec/hevc/data.h -libavcodec/hevc/dsp.h -libavcodec/hevc/hevc.h -libavcodec/hevc/hevcdec.h -libavcodec/hevc/parse.c -libavcodec/hevc/parse.h -libavcodec/hevc/parser.c -libavcodec/hevc/pred.h -libavcodec/hevc/ps.c -libavcodec/hevc/ps.h -libavcodec/hevc/ps_enc.c -libavcodec/hevc/sei.c -libavcodec/hevc/sei.h -libavcodec/hnm4video.c -libavcodec/hpel_template.c -libavcodec/hpeldsp.c -libavcodec/hpeldsp.h -libavcodec/hq_hqa.c -libavcodec/hq_hqadata.h -libavcodec/hq_hqadsp.c -libavcodec/hq_hqadsp.h -libavcodec/hqx.c -libavcodec/hqx.h -libavcodec/hqxdsp.c -libavcodec/hqxdsp.h -libavcodec/hqxvlc.c -libavcodec/htmlsubtitles.c -libavcodec/htmlsubtitles.h -libavcodec/huffman.c -libavcodec/huffman.h -libavcodec/huffyuv.c -libavcodec/huffyuv.h -libavcodec/huffyuvdec.c -libavcodec/huffyuvdsp.c -libavcodec/huffyuvdsp.h -libavcodec/huffyuvenc.c -libavcodec/huffyuvencdsp.c -libavcodec/huffyuvencdsp.h -libavcodec/hw_base_encode.c -libavcodec/hw_base_encode.h -libavcodec/hw_base_encode_h264.c -libavcodec/hw_base_encode_h264.h -libavcodec/hw_base_encode_h265.c -libavcodec/hw_base_encode_h265.h -libavcodec/hwaccel_internal.h -libavcodec/hwaccels.h -libavcodec/hwconfig.h -libavcodec/idcinvideo.c -libavcodec/idctdsp.c -libavcodec/idctdsp.h -libavcodec/iff.c -libavcodec/iirfilter.c -libavcodec/iirfilter.h -libavcodec/ilbcdata.h -libavcodec/ilbcdec.c -libavcodec/imc.c -libavcodec/imcdata.h -libavcodec/imgconvert.c -libavcodec/imx.c -libavcodec/indeo2.c -libavcodec/indeo2data.h -libavcodec/indeo3.c -libavcodec/indeo3data.h -libavcodec/indeo4.c -libavcodec/indeo4data.h -libavcodec/indeo5.c -libavcodec/indeo5data.h -libavcodec/intelh263dec.c -libavcodec/internal.h -libavcodec/interplayacm.c -libavcodec/interplayvideo.c -libavcodec/intrax8.c -libavcodec/intrax8.h -libavcodec/intrax8dsp.c -libavcodec/intrax8dsp.h -libavcodec/intrax8huf.h -libavcodec/ipu_parser.c -libavcodec/ituh263dec.c -libavcodec/ituh263enc.c -libavcodec/itut35.h -libavcodec/ivi.c -libavcodec/ivi.h -libavcodec/ivi_dsp.c -libavcodec/ivi_dsp.h -libavcodec/j2kenc.c -libavcodec/jacosub.h -libavcodec/jacosubdec.c -libavcodec/jfdctfst.c -libavcodec/jfdctint.c -libavcodec/jfdctint_template.c -libavcodec/jni.c -libavcodec/jni.h -libavcodec/jpeg2000.c -libavcodec/jpeg2000.h -libavcodec/jpeg2000_parser.c -libavcodec/jpeg2000dec.c -libavcodec/jpeg2000dec.h -libavcodec/jpeg2000dsp.c -libavcodec/jpeg2000dsp.h -libavcodec/jpeg2000dwt.c -libavcodec/jpeg2000dwt.h -libavcodec/jpeg2000htdec.c -libavcodec/jpeg2000htdec.h -libavcodec/jpegls.c -libavcodec/jpegls.h -libavcodec/jpeglsdec.c -libavcodec/jpeglsdec.h -libavcodec/jpeglsenc.c -libavcodec/jpegquanttables.c -libavcodec/jpegquanttables.h -libavcodec/jpegtables.c -libavcodec/jpegtables.h -libavcodec/jpegtabs.h -libavcodec/jpegxl.h -libavcodec/jpegxl_parse.c -libavcodec/jpegxl_parse.h -libavcodec/jpegxl_parser.c -libavcodec/jrevdct.c -libavcodec/jvdec.c -libavcodec/kbdwin.c -libavcodec/kbdwin.h -libavcodec/kgv1dec.c -libavcodec/kmvc.c -libavcodec/lagarith.c -libavcodec/lagarithrac.c -libavcodec/lagarithrac.h -libavcodec/latm_parser.c -libavcodec/lcevcdec.c -libavcodec/lcevcdec.h -libavcodec/lcl.h -libavcodec/lcldec.c -libavcodec/lclenc.c -libavcodec/leb.h -libavcodec/libaom.c -libavcodec/libaom.h -libavcodec/libaomdec.c -libavcodec/libaomenc.c -libavcodec/libaribb24.c -libavcodec/libaribcaption.c -libavcodec/libavcodec.v -libavcodec/libcodec2.c -libavcodec/libdav1d.c -libavcodec/libfdk-aacdec.c -libavcodec/libfdk-aacenc.c -libavcodec/libgsmdec.c -libavcodec/libgsmenc.c -libavcodec/libilbc.c -libavcodec/libjxl.c -libavcodec/libjxl.h -libavcodec/libjxldec.c -libavcodec/libjxlenc.c -libavcodec/liblc3dec.c -libavcodec/liblc3enc.c -libavcodec/libmp3lame.c -libavcodec/libopencore-amr.c -libavcodec/libopenh264.c -libavcodec/libopenh264.h -libavcodec/libopenh264dec.c -libavcodec/libopenh264enc.c -libavcodec/libopenjpegenc.c -libavcodec/libopus.c -libavcodec/libopus.h -libavcodec/libopusdec.c -libavcodec/libopusenc.c -libavcodec/librav1e.c -libavcodec/librsvgdec.c -libavcodec/libspeexdec.c -libavcodec/libspeexenc.c -libavcodec/libsvtav1.c -libavcodec/libtheoraenc.c -libavcodec/libtwolame.c -libavcodec/libvo-amrwbenc.c -libavcodec/libvorbisdec.c -libavcodec/libvorbisenc.c -libavcodec/libvpx.h -libavcodec/libvpxdec.c -libavcodec/libvpxenc.c -libavcodec/libwebpenc.c -libavcodec/libwebpenc_animencoder.c -libavcodec/libwebpenc_common.c -libavcodec/libwebpenc_common.h -libavcodec/libxevd.c -libavcodec/libxeve.c -libavcodec/libxvid.c -libavcodec/libzvbi-teletextdec.c -libavcodec/loco.c -libavcodec/log2_tab.c -libavcodec/loongarch/Makefile -libavcodec/lossless_audiodsp.c -libavcodec/lossless_audiodsp.h -libavcodec/lossless_videodsp.c -libavcodec/lossless_videodsp.h -libavcodec/lossless_videoencdsp.c -libavcodec/lossless_videoencdsp.h -libavcodec/lpc.c -libavcodec/lpc.h -libavcodec/lpc_functions.h -libavcodec/lscrdec.c -libavcodec/lsp.c -libavcodec/lsp.h -libavcodec/lzw.c -libavcodec/lzw.h -libavcodec/lzwenc.c -libavcodec/m101.c -libavcodec/mace.c -libavcodec/mathops.h -libavcodec/mathtables.c -libavcodec/mdec.c -libavcodec/me_cmp.c -libavcodec/me_cmp.h -libavcodec/mediacodec.c -libavcodec/mediacodec.h -libavcodec/metasound.c -libavcodec/metasound_data.h -libavcodec/metasound_twinvq_data.h -libavcodec/microdvddec.c -libavcodec/midivid.c -libavcodec/mimic.c -libavcodec/mips/Makefile -libavcodec/mips/amrwbdec_mips.h -libavcodec/mips/lsp_mips.h -libavcodec/misc4.c -libavcodec/misc4_parser.c -libavcodec/mjpeg.h -libavcodec/mjpeg_parser.c -libavcodec/mjpegbdec.c -libavcodec/mjpegdec.c -libavcodec/mjpegdec.h -libavcodec/mjpegdec_common.c -libavcodec/mjpegenc.c -libavcodec/mjpegenc.h -libavcodec/mjpegenc_common.c -libavcodec/mjpegenc_common.h -libavcodec/mjpegenc_huffman.c -libavcodec/mjpegenc_huffman.h -libavcodec/mlp.c -libavcodec/mlp.h -libavcodec/mlp_parse.c -libavcodec/mlp_parse.h -libavcodec/mlp_parser.c -libavcodec/mlpdec.c -libavcodec/mlpdsp.c -libavcodec/mlpdsp.h -libavcodec/mlpenc.c -libavcodec/mmvideo.c -libavcodec/motion_est.c -libavcodec/motion_est.h -libavcodec/motion_est_template.c -libavcodec/motionpixels.c -libavcodec/motionpixels_tablegen.h -libavcodec/mpc.c -libavcodec/mpc.h -libavcodec/mpc7.c -libavcodec/mpc7data.h -libavcodec/mpc8.c -libavcodec/mpc8data.h -libavcodec/mpc8huff.h -libavcodec/mpcdata.h -libavcodec/mpeg12.c -libavcodec/mpeg12.h -libavcodec/mpeg12codecs.h -libavcodec/mpeg12data.c -libavcodec/mpeg12data.h -libavcodec/mpeg12dec.c -libavcodec/mpeg12dec.h -libavcodec/mpeg12enc.c -libavcodec/mpeg12enc.h -libavcodec/mpeg12framerate.c -libavcodec/mpeg12vlc.h -libavcodec/mpeg4audio.c -libavcodec/mpeg4audio.h -libavcodec/mpeg4audio_copy_pce.h -libavcodec/mpeg4audio_sample_rates.c -libavcodec/mpeg4audio_sample_rates.h -libavcodec/mpeg4data.h -libavcodec/mpeg4video.c -libavcodec/mpeg4video.h -libavcodec/mpeg4video_parser.c -libavcodec/mpeg4videodata.h -libavcodec/mpeg4videodec.c -libavcodec/mpeg4videodec.h -libavcodec/mpeg4videodefs.h -libavcodec/mpeg4videodsp.c -libavcodec/mpeg4videodsp.h -libavcodec/mpeg4videoenc.c -libavcodec/mpeg4videoenc.h -libavcodec/mpeg_er.c -libavcodec/mpeg_er.h -libavcodec/mpegaudio.c -libavcodec/mpegaudio.h -libavcodec/mpegaudio_parser.c -libavcodec/mpegaudio_tablegen.h -libavcodec/mpegaudiodata.c -libavcodec/mpegaudiodata.h -libavcodec/mpegaudiodec_common.c -libavcodec/mpegaudiodec_common_tablegen.h -libavcodec/mpegaudiodec_fixed.c -libavcodec/mpegaudiodec_float.c -libavcodec/mpegaudiodec_template.c -libavcodec/mpegaudiodecheader.c -libavcodec/mpegaudiodecheader.h -libavcodec/mpegaudiodsp.c -libavcodec/mpegaudiodsp.h -libavcodec/mpegaudiodsp_data.c -libavcodec/mpegaudiodsp_fixed.c -libavcodec/mpegaudiodsp_float.c -libavcodec/mpegaudiodsp_template.c -libavcodec/mpegaudioenc_fixed.c -libavcodec/mpegaudioenc_float.c -libavcodec/mpegaudioenc_template.c -libavcodec/mpegaudiotab.h -libavcodec/mpegaudiotabs.c -libavcodec/mpegaudiotabs.h -libavcodec/mpegpicture.c -libavcodec/mpegpicture.h -libavcodec/mpegutils.c -libavcodec/mpegutils.h -libavcodec/mpegvideo.c -libavcodec/mpegvideo.h -libavcodec/mpegvideo_dec.c -libavcodec/mpegvideo_enc.c -libavcodec/mpegvideo_motion.c -libavcodec/mpegvideo_parser.c -libavcodec/mpegvideodata.c -libavcodec/mpegvideodata.h -libavcodec/mpegvideodec.h -libavcodec/mpegvideoenc.h -libavcodec/mpegvideoencdsp.c -libavcodec/mpegvideoencdsp.h -libavcodec/mpl2dec.c -libavcodec/mpv_reconstruct_mb_template.c -libavcodec/mqc.c -libavcodec/mqc.h -libavcodec/mqcdec.c -libavcodec/mqcenc.c -libavcodec/mscc.c -libavcodec/msgsmdec.c -libavcodec/msgsmdec.h -libavcodec/msmpeg4.c -libavcodec/msmpeg4.h -libavcodec/msmpeg4_vc1_data.c -libavcodec/msmpeg4_vc1_data.h -libavcodec/msmpeg4data.c -libavcodec/msmpeg4data.h -libavcodec/msmpeg4dec.c -libavcodec/msmpeg4dec.h -libavcodec/msmpeg4enc.c -libavcodec/msmpeg4enc.h -libavcodec/msp2dec.c -libavcodec/msrle.c -libavcodec/msrledec.c -libavcodec/msrledec.h -libavcodec/mss1.c -libavcodec/mss12.c -libavcodec/mss12.h -libavcodec/mss3.c -libavcodec/mss34dsp.c -libavcodec/mss34dsp.h -libavcodec/mss4.c -libavcodec/msvideo1.c -libavcodec/msvideo1enc.c -libavcodec/mv30.c -libavcodec/mvcdec.c -libavcodec/mvha.c -libavcodec/mwsc.c -libavcodec/mxpegdec.c -libavcodec/nellymoser.c -libavcodec/nellymoser.h -libavcodec/nellymoserdec.c -libavcodec/nellymoserenc.c -libavcodec/neon/Makefile -libavcodec/neon/mpegvideo.c -libavcodec/null.c -libavcodec/nuv.c -libavcodec/nvdec.c -libavcodec/nvdec.h -libavcodec/nvdec_av1.c -libavcodec/nvdec_mjpeg.c -libavcodec/nvdec_mpeg12.c -libavcodec/nvdec_mpeg4.c -libavcodec/nvdec_vp8.c -libavcodec/nvdec_vp9.c -libavcodec/nvenc.c -libavcodec/nvenc.h -libavcodec/nvenc_av1.c -libavcodec/nvenc_h264.c -libavcodec/nvenc_hevc.c -libavcodec/on2avc.c -libavcodec/on2avcdata.c -libavcodec/on2avcdata.h -libavcodec/options.c -libavcodec/options_table.h -libavcodec/opus/Makefile -libavcodec/opus/celt.c -libavcodec/opus/celt.h -libavcodec/opus/dec.c -libavcodec/opus/dec_celt.c -libavcodec/opus/dsp.c -libavcodec/opus/dsp.h -libavcodec/opus/enc.c -libavcodec/opus/enc.h -libavcodec/opus/enc_psy.c -libavcodec/opus/enc_psy.h -libavcodec/opus/enc_utils.h -libavcodec/opus/opus.h -libavcodec/opus/parse.c -libavcodec/opus/parse.h -libavcodec/opus/parser.c -libavcodec/opus/pvq.c -libavcodec/opus/pvq.h -libavcodec/opus/rc.c -libavcodec/opus/rc.h -libavcodec/opus/silk.c -libavcodec/opus/silk.h -libavcodec/opus/tab.c -libavcodec/opus/tab.h -libavcodec/packet.c -libavcodec/packet.h -libavcodec/packet_internal.h -libavcodec/paf.h -libavcodec/pafaudio.c -libavcodec/pafvideo.c -libavcodec/pamenc.c -libavcodec/parser.c -libavcodec/parser.h -libavcodec/parsers.c -libavcodec/pcm-bluray.c -libavcodec/pcm-dvd.c -libavcodec/pcm.c -libavcodec/pcm_tablegen.h -libavcodec/pcx.c -libavcodec/pcxenc.c -libavcodec/pel_template.c -libavcodec/pgssubdec.c -libavcodec/pgxdec.c -libavcodec/photocd.c -libavcodec/pictordec.c -libavcodec/pixblockdsp.c -libavcodec/pixblockdsp.h -libavcodec/pixels.h -libavcodec/png.c -libavcodec/png.h -libavcodec/png_parser.c -libavcodec/pngdec.c -libavcodec/pngdsp.c -libavcodec/pngdsp.h -libavcodec/pngenc.c -libavcodec/pnm.c -libavcodec/pnm.h -libavcodec/pnm_parser.c -libavcodec/pnmdec.c -libavcodec/pnmenc.c -libavcodec/ppc/Makefile -libavcodec/ppc/asm.S -libavcodec/ppc/audiodsp.c -libavcodec/ppc/blockdsp.c -libavcodec/ppc/fdct.h -libavcodec/ppc/fdctdsp.c -libavcodec/ppc/fmtconvert_altivec.c -libavcodec/ppc/h264chroma_init.c -libavcodec/ppc/h264chroma_template.c -libavcodec/ppc/h264dsp.c -libavcodec/ppc/h264qpel.c -libavcodec/ppc/h264qpel_template.c -libavcodec/ppc/hpeldsp_altivec.c -libavcodec/ppc/hpeldsp_altivec.h -libavcodec/ppc/idctdsp.c -libavcodec/ppc/lossless_audiodsp_altivec.c -libavcodec/ppc/lossless_videodsp_altivec.c -libavcodec/ppc/mathops.h -libavcodec/ppc/me_cmp.c -libavcodec/ppc/mpeg4videodsp.c -libavcodec/ppc/mpegaudiodsp_altivec.c -libavcodec/ppc/mpegvideo_altivec.c -libavcodec/ppc/mpegvideoencdsp.c -libavcodec/ppc/pixblockdsp.c -libavcodec/ppc/svq1enc_altivec.c -libavcodec/ppc/vc1dsp_altivec.c -libavcodec/ppc/videodsp.c -libavcodec/ppc/vorbisdsp_altivec.c -libavcodec/ppc/vp3dsp_altivec.c -libavcodec/ppc/vp8dsp_altivec.c -libavcodec/profiles.c -libavcodec/profiles.h -libavcodec/progressframe.h -libavcodec/prosumer.c -libavcodec/psd.c -libavcodec/psymodel.c -libavcodec/psymodel.h -libavcodec/pthread.c -libavcodec/pthread_frame.c -libavcodec/pthread_internal.h -libavcodec/pthread_slice.c -libavcodec/ptx.c -libavcodec/put_bits.h -libavcodec/put_golomb.h -libavcodec/qcelpdata.h -libavcodec/qcelpdec.c -libavcodec/qdm2.c -libavcodec/qdm2_tablegen.h -libavcodec/qdm2data.h -libavcodec/qdmc.c -libavcodec/qdrw.c -libavcodec/qoadec.c -libavcodec/qoi.h -libavcodec/qoi_parser.c -libavcodec/qoidec.c -libavcodec/qoienc.c -libavcodec/qpeg.c -libavcodec/qpel_template.c -libavcodec/qpeldsp.c -libavcodec/qpeldsp.h -libavcodec/qsv.c -libavcodec/qsv.h -libavcodec/qsv_api.c -libavcodec/qsv_internal.h -libavcodec/qsvdec.c -libavcodec/qsvenc.c -libavcodec/qsvenc.h -libavcodec/qsvenc_av1.c -libavcodec/qsvenc_h264.c -libavcodec/qsvenc_hevc.c -libavcodec/qsvenc_jpeg.c -libavcodec/qsvenc_mpeg2.c -libavcodec/qsvenc_vp9.c -libavcodec/qtrle.c -libavcodec/qtrleenc.c -libavcodec/r210dec.c -libavcodec/r210enc.c -libavcodec/ra144.c -libavcodec/ra144.h -libavcodec/ra144dec.c -libavcodec/ra144enc.c -libavcodec/ra288.c -libavcodec/ra288.h -libavcodec/rangecoder.c -libavcodec/rangecoder.h -libavcodec/rasc.c -libavcodec/ratecontrol.c -libavcodec/ratecontrol.h -libavcodec/raw.c -libavcodec/raw.h -libavcodec/rawdec.c -libavcodec/rawenc.c -libavcodec/realtextdec.c -libavcodec/rectangle.h -libavcodec/refstruct.c -libavcodec/refstruct.h -libavcodec/reverse.c -libavcodec/riscv/Makefile -libavcodec/riscv/aacencdsp_init.c -libavcodec/riscv/aacencdsp_rvv.S -libavcodec/riscv/aacpsdsp_init.c -libavcodec/riscv/aacpsdsp_rvv.S -libavcodec/riscv/ac3dsp_init.c -libavcodec/riscv/ac3dsp_rvb.S -libavcodec/riscv/ac3dsp_rvv.S -libavcodec/riscv/ac3dsp_rvvb.S -libavcodec/riscv/alacdsp_init.c -libavcodec/riscv/alacdsp_rvv.S -libavcodec/riscv/audiodsp_init.c -libavcodec/riscv/audiodsp_rvv.S -libavcodec/riscv/blockdsp_init.c -libavcodec/riscv/blockdsp_rvv.S -libavcodec/riscv/bswapdsp_init.c -libavcodec/riscv/bswapdsp_rvb.S -libavcodec/riscv/bswapdsp_rvv.S -libavcodec/riscv/bswapdsp_rvvb.S -libavcodec/riscv/cpu_common.c -libavcodec/riscv/exrdsp_init.c -libavcodec/riscv/exrdsp_rvv.S -libavcodec/riscv/fixed_vtype.S -libavcodec/riscv/flacdsp_init.c -libavcodec/riscv/flacdsp_rvv.S -libavcodec/riscv/fmtconvert_init.c -libavcodec/riscv/fmtconvert_rvv.S -libavcodec/riscv/g722dsp_init.c -libavcodec/riscv/g722dsp_rvv.S -libavcodec/riscv/h263dsp_init.c -libavcodec/riscv/h263dsp_rvv.S -libavcodec/riscv/h264_chroma_init_riscv.c -libavcodec/riscv/h264_mc_chroma.S -libavcodec/riscv/h264addpx_rvv.S -libavcodec/riscv/h264dsp_init.c -libavcodec/riscv/h264dsp_rvv.S -libavcodec/riscv/h264idct_rvv.S -libavcodec/riscv/huffyuvdsp_init.c -libavcodec/riscv/huffyuvdsp_rvv.S -libavcodec/riscv/idctdsp_init.c -libavcodec/riscv/idctdsp_rvv.S -libavcodec/riscv/jpeg2000dsp_init.c -libavcodec/riscv/jpeg2000dsp_rvv.S -libavcodec/riscv/llauddsp_init.c -libavcodec/riscv/llauddsp_rvv.S -libavcodec/riscv/llviddsp_init.c -libavcodec/riscv/llviddsp_rvv.S -libavcodec/riscv/llvidencdsp_init.c -libavcodec/riscv/llvidencdsp_rvv.S -libavcodec/riscv/lpc_init.c -libavcodec/riscv/lpc_rvv.S -libavcodec/riscv/me_cmp_init.c -libavcodec/riscv/me_cmp_rvv.S -libavcodec/riscv/mpegvideoencdsp_init.c -libavcodec/riscv/mpegvideoencdsp_rvv.S -libavcodec/riscv/opusdsp_init.c -libavcodec/riscv/opusdsp_rvv.S -libavcodec/riscv/pixblockdsp_init.c -libavcodec/riscv/pixblockdsp_rvi.S -libavcodec/riscv/pixblockdsp_rvv.S -libavcodec/riscv/rv34dsp_init.c -libavcodec/riscv/rv34dsp_rvv.S -libavcodec/riscv/rv40dsp_init.c -libavcodec/riscv/rv40dsp_rvv.S -libavcodec/riscv/sbrdsp_init.c -libavcodec/riscv/sbrdsp_rvv.S -libavcodec/riscv/startcode_rvb.S -libavcodec/riscv/startcode_rvv.S -libavcodec/riscv/svqenc_init.c -libavcodec/riscv/svqenc_rvv.S -libavcodec/riscv/takdsp_init.c -libavcodec/riscv/takdsp_rvv.S -libavcodec/riscv/utvideodsp_init.c -libavcodec/riscv/utvideodsp_rvv.S -libavcodec/riscv/vc1dsp_init.c -libavcodec/riscv/vc1dsp_rvi.S -libavcodec/riscv/vc1dsp_rvv.S -libavcodec/riscv/videodsp.S -libavcodec/riscv/videodsp_init.c -libavcodec/riscv/vorbisdsp_init.c -libavcodec/riscv/vorbisdsp_rvv.S -libavcodec/riscv/vp7dsp_init.c -libavcodec/riscv/vp7dsp_rvv.S -libavcodec/riscv/vp8dsp.h -libavcodec/riscv/vp8dsp_init.c -libavcodec/riscv/vp8dsp_rvi.S -libavcodec/riscv/vp8dsp_rvv.S -libavcodec/riscv/vp9_intra_rvv.S -libavcodec/riscv/vp9_mc_rvi.S -libavcodec/riscv/vp9_mc_rvv.S -libavcodec/riscv/vp9dsp.h -libavcodec/riscv/vp9dsp_init.c -libavcodec/rka.c -libavcodec/rl.c -libavcodec/rl.h -libavcodec/rl2.c -libavcodec/rle.c -libavcodec/rle.h -libavcodec/rnd_avg.h -libavcodec/roqaudioenc.c -libavcodec/roqvideo.c -libavcodec/roqvideo.h -libavcodec/roqvideodec.c -libavcodec/roqvideoenc.c -libavcodec/rpza.c -libavcodec/rpzaenc.c -libavcodec/rscc.c -libavcodec/rtjpeg.c -libavcodec/rtjpeg.h -libavcodec/rv10.c -libavcodec/rv10dec.h -libavcodec/rv10enc.c -libavcodec/rv10enc.h -libavcodec/rv20enc.c -libavcodec/rv34_parser.c -libavcodec/s302m.c -libavcodec/s302menc.c -libavcodec/samidec.c -libavcodec/sanm.c -libavcodec/sbc.c -libavcodec/sbc.h -libavcodec/sbc_parser.c -libavcodec/sbcdec.c -libavcodec/sbcdec_data.c -libavcodec/sbcdec_data.h -libavcodec/sbcdsp.c -libavcodec/sbcdsp.h -libavcodec/sbcdsp_data.c -libavcodec/sbcdsp_data.h -libavcodec/sbcenc.c -libavcodec/sbr.h -libavcodec/sbrdsp.c -libavcodec/sbrdsp.h -libavcodec/sbrdsp_template.c -libavcodec/screenpresso.c -libavcodec/sei.h -libavcodec/sgi.h -libavcodec/sgidec.c -libavcodec/sgienc.c -libavcodec/sgirledec.c -libavcodec/shorten.c -libavcodec/simple_idct.c -libavcodec/simple_idct.h -libavcodec/simple_idct_template.c -libavcodec/sinewin.c -libavcodec/sinewin.h -libavcodec/sinewin_tablegen.h -libavcodec/sipr.c -libavcodec/sipr.h -libavcodec/sipr16k.c -libavcodec/sipr16kdata.h -libavcodec/sipr_parser.c -libavcodec/siprdata.h -libavcodec/siren.c -libavcodec/smacker.c -libavcodec/smc.c -libavcodec/smcenc.c -libavcodec/snappy.c -libavcodec/snappy.h -libavcodec/snow.c -libavcodec/snow.h -libavcodec/snow_dwt.c -libavcodec/snow_dwt.h -libavcodec/snowdata.h -libavcodec/snowdec.c -libavcodec/snowenc.c -libavcodec/sonic.c -libavcodec/sp5x.h -libavcodec/sp5xdec.c -libavcodec/speedhq.c -libavcodec/speedhq.h -libavcodec/speedhqdec.c -libavcodec/speedhqenc.c -libavcodec/speedhqenc.h -libavcodec/speexdata.h -libavcodec/speexdec.c -libavcodec/srtdec.c -libavcodec/srtenc.c -libavcodec/startcode.c -libavcodec/startcode.h -libavcodec/subviewerdec.c -libavcodec/sunrast.c -libavcodec/sunrast.h -libavcodec/sunrastenc.c -libavcodec/svq1.c -libavcodec/svq1.h -libavcodec/svq1_cb.h -libavcodec/svq1_vlc.h -libavcodec/svq1dec.c -libavcodec/svq1enc.c -libavcodec/svq1enc_cb.h -libavcodec/svq1encdsp.h -libavcodec/svq3.c -libavcodec/synth_filter.c -libavcodec/synth_filter.h -libavcodec/tak.c -libavcodec/tak.h -libavcodec/tak_parser.c -libavcodec/takdec.c -libavcodec/takdsp.c -libavcodec/takdsp.h -libavcodec/targa.c -libavcodec/targa.h -libavcodec/targa_y216dec.c -libavcodec/targaenc.c -libavcodec/tdsc.c -libavcodec/textdec.c -libavcodec/texturedsp.c -libavcodec/texturedsp.h -libavcodec/texturedsp_template.c -libavcodec/texturedspenc.c -libavcodec/thread.h -libavcodec/threadframe.h -libavcodec/threadprogress.c -libavcodec/threadprogress.h -libavcodec/tiertexseqv.c -libavcodec/tiff.c -libavcodec/tiff.h -libavcodec/tiff_common.c -libavcodec/tiff_common.h -libavcodec/tiff_data.h -libavcodec/tiffenc.c -libavcodec/tmv.c -libavcodec/to_upper4.c -libavcodec/to_upper4.h -libavcodec/tpeldsp.c -libavcodec/tpeldsp.h -libavcodec/truemotion1.c -libavcodec/truemotion1data.h -libavcodec/truemotion2.c -libavcodec/truemotion2rt.c -libavcodec/truespeech.c -libavcodec/truespeech_data.h -libavcodec/tscc.c -libavcodec/tscc2.c -libavcodec/tscc2data.h -libavcodec/tta.c -libavcodec/ttadata.c -libavcodec/ttadata.h -libavcodec/ttadsp.c -libavcodec/ttadsp.h -libavcodec/ttaenc.c -libavcodec/ttaencdsp.c -libavcodec/ttaencdsp.h -libavcodec/ttmlenc.c -libavcodec/ttmlenc.h -libavcodec/twinvq.c -libavcodec/twinvq.h -libavcodec/twinvq_data.h -libavcodec/twinvqdec.c -libavcodec/txd.c -libavcodec/ulti.c -libavcodec/ulti_cb.h -libavcodec/unary.h -libavcodec/utils.c -libavcodec/utvideo.h -libavcodec/utvideodec.c -libavcodec/utvideodsp.c -libavcodec/utvideodsp.h -libavcodec/utvideoenc.c -libavcodec/v210_template.c -libavcodec/v210dec.c -libavcodec/v210dec.h -libavcodec/v210dec_init.h -libavcodec/v210enc.c -libavcodec/v210enc.h -libavcodec/v210enc_init.h -libavcodec/v210x.c -libavcodec/v308dec.c -libavcodec/v308enc.c -libavcodec/v408dec.c -libavcodec/v408enc.c -libavcodec/v410dec.c -libavcodec/v410enc.c -libavcodec/v4l2_buffers.c -libavcodec/v4l2_buffers.h -libavcodec/v4l2_context.c -libavcodec/v4l2_context.h -libavcodec/v4l2_fmt.c -libavcodec/v4l2_fmt.h -libavcodec/v4l2_m2m.c -libavcodec/v4l2_m2m.h -libavcodec/v4l2_m2m_dec.c -libavcodec/v4l2_m2m_enc.c -libavcodec/vaapi_av1.c -libavcodec/vaapi_decode.c -libavcodec/vaapi_decode.h -libavcodec/vaapi_encode.c -libavcodec/vaapi_encode.h -libavcodec/vaapi_encode_av1.c -libavcodec/vaapi_encode_h264.c -libavcodec/vaapi_encode_h265.c -libavcodec/vaapi_encode_mjpeg.c -libavcodec/vaapi_encode_mpeg2.c -libavcodec/vaapi_encode_vp8.c -libavcodec/vaapi_encode_vp9.c -libavcodec/vaapi_hevc.h -libavcodec/vaapi_mjpeg.c -libavcodec/vaapi_mpeg2.c -libavcodec/vaapi_mpeg4.c -libavcodec/vaapi_vp8.c -libavcodec/vaapi_vp9.c -libavcodec/vb.c -libavcodec/vble.c -libavcodec/vbn.h -libavcodec/vc1.c -libavcodec/vc1.h -libavcodec/vc1_common.h -libavcodec/vc1_parser.c -libavcodec/vc1_pred.h -libavcodec/vc1acdata.h -libavcodec/vc1data.c -libavcodec/vc1data.h -libavcodec/vc1dsp.c -libavcodec/vc1dsp.h -libavcodec/vc2enc.c -libavcodec/vc2enc_dwt.c -libavcodec/vc2enc_dwt.h -libavcodec/vcr1.c -libavcodec/vdpau.c -libavcodec/vdpau.h -libavcodec/vdpau_av1.c -libavcodec/vdpau_internal.h -libavcodec/vdpau_mpeg12.c -libavcodec/vdpau_mpeg4.c -libavcodec/vdpau_vp9.c -libavcodec/version.c -libavcodec/version.h -libavcodec/version_major.h -libavcodec/videodsp.c -libavcodec/videodsp.h -libavcodec/videodsp_template.c -libavcodec/videotoolbox.h -libavcodec/vima.c -libavcodec/vlc.c -libavcodec/vlc.h -libavcodec/vmdaudio.c -libavcodec/vmdvideo.c -libavcodec/vmnc.c -libavcodec/vorbis.c -libavcodec/vorbis.h -libavcodec/vorbis_data.c -libavcodec/vorbis_data.h -libavcodec/vorbis_enc_data.h -libavcodec/vorbis_parser.c -libavcodec/vorbis_parser.h -libavcodec/vorbis_parser_internal.h -libavcodec/vorbisdec.c -libavcodec/vorbisdsp.c -libavcodec/vorbisdsp.h -libavcodec/vorbisenc.c -libavcodec/vp3.c -libavcodec/vp3_parser.c -libavcodec/vp3data.h -libavcodec/vp3dsp.c -libavcodec/vp3dsp.h -libavcodec/vp4data.h -libavcodec/vp5.c -libavcodec/vp56.c -libavcodec/vp56.h -libavcodec/vp56data.c -libavcodec/vp56data.h -libavcodec/vp56dsp.c -libavcodec/vp56dsp.h -libavcodec/vp5data.h -libavcodec/vp6.c -libavcodec/vp6data.h -libavcodec/vp6dsp.c -libavcodec/vp8.c -libavcodec/vp8.h -libavcodec/vp89_rac.h -libavcodec/vp8_parser.c -libavcodec/vp8data.c -libavcodec/vp8data.h -libavcodec/vp8dsp.c -libavcodec/vp8dsp.h -libavcodec/vp9.c -libavcodec/vp9.h -libavcodec/vp9_mc_template.c -libavcodec/vp9_parser.c -libavcodec/vp9block.c -libavcodec/vp9data.c -libavcodec/vp9data.h -libavcodec/vp9dec.h -libavcodec/vp9dsp.c -libavcodec/vp9dsp.h -libavcodec/vp9dsp_10bpp.c -libavcodec/vp9dsp_12bpp.c -libavcodec/vp9dsp_8bpp.c -libavcodec/vp9dsp_template.c -libavcodec/vp9lpf.c -libavcodec/vp9mvs.c -libavcodec/vp9prob.c -libavcodec/vp9recon.c -libavcodec/vp9shared.h -libavcodec/vpx_rac.c -libavcodec/vpx_rac.h -libavcodec/vqavideo.c -libavcodec/vqcdec.c -libavcodec/vulkan.c -libavcodec/vulkan.h -libavcodec/vulkan_av1.c -libavcodec/vulkan_decode.c -libavcodec/vulkan_decode.h -libavcodec/vulkan_encode.c -libavcodec/vulkan_encode.h -libavcodec/vulkan_video.c -libavcodec/vulkan_video.h -libavcodec/vvc.h -libavcodec/vvc/Makefile -libavcodec/vvc/cabac.c -libavcodec/vvc/cabac.h -libavcodec/vvc/ctu.c -libavcodec/vvc/ctu.h -libavcodec/vvc/data.c -libavcodec/vvc/data.h -libavcodec/vvc/dec.c -libavcodec/vvc/dec.h -libavcodec/vvc/dsp.c -libavcodec/vvc/dsp.h -libavcodec/vvc/dsp_template.c -libavcodec/vvc/filter.c -libavcodec/vvc/filter.h -libavcodec/vvc/filter_template.c -libavcodec/vvc/inter.c -libavcodec/vvc/inter.h -libavcodec/vvc/inter_template.c -libavcodec/vvc/intra.c -libavcodec/vvc/intra.h -libavcodec/vvc/intra_template.c -libavcodec/vvc/intra_utils.c -libavcodec/vvc/itx_1d.c -libavcodec/vvc/itx_1d.h -libavcodec/vvc/mvs.c -libavcodec/vvc/mvs.h -libavcodec/vvc/ps.c -libavcodec/vvc/ps.h -libavcodec/vvc/refs.c -libavcodec/vvc/refs.h -libavcodec/vvc/thread.c -libavcodec/vvc/thread.h -libavcodec/vvc_parser.c -libavcodec/wavarc.c -libavcodec/wavpack.c -libavcodec/wavpack.h -libavcodec/wavpackdata.c -libavcodec/wavpackenc.c -libavcodec/wavpackenc.h -libavcodec/wbmpdec.c -libavcodec/wbmpenc.c -libavcodec/wcmv.c -libavcodec/webp.c -libavcodec/webp_parser.c -libavcodec/webvttdec.c -libavcodec/webvttenc.c -libavcodec/wma.c -libavcodec/wma.h -libavcodec/wma_common.c -libavcodec/wma_common.h -libavcodec/wma_freqs.c -libavcodec/wma_freqs.h -libavcodec/wmadata.h -libavcodec/wmadec.c -libavcodec/wmaenc.c -libavcodec/wmavoice.c -libavcodec/wmavoice_data.h -libavcodec/wmv2.c -libavcodec/wmv2.h -libavcodec/wmv2data.c -libavcodec/wmv2data.h -libavcodec/wmv2dec.c -libavcodec/wmv2dec.h -libavcodec/wmv2dsp.c -libavcodec/wmv2dsp.h -libavcodec/wmv2enc.c -libavcodec/wmv2enc.h -libavcodec/wnv1.c -libavcodec/wrapped_avframe.c -libavcodec/ws-snd1.c -libavcodec/x86/Makefile -libavcodec/x86/aacencdsp.asm -libavcodec/x86/aacencdsp_init.c -libavcodec/x86/aacpsdsp.asm -libavcodec/x86/aacpsdsp_init.c -libavcodec/x86/ac3dsp.asm -libavcodec/x86/ac3dsp_downmix.asm -libavcodec/x86/ac3dsp_init.c -libavcodec/x86/alacdsp.asm -libavcodec/x86/alacdsp_init.c -libavcodec/x86/audiodsp.asm -libavcodec/x86/audiodsp_init.c -libavcodec/x86/blockdsp.asm -libavcodec/x86/blockdsp_init.c -libavcodec/x86/bswapdsp.asm -libavcodec/x86/bswapdsp_init.c -libavcodec/x86/cabac.h -libavcodec/x86/cavsdsp.c -libavcodec/x86/cavsidct.asm -libavcodec/x86/celt_pvq_init.c -libavcodec/x86/celt_pvq_search.asm -libavcodec/x86/cfhddsp.asm -libavcodec/x86/cfhddsp_init.c -libavcodec/x86/cfhdencdsp.asm -libavcodec/x86/cfhdencdsp_init.c -libavcodec/x86/constants.c -libavcodec/x86/constants.h -libavcodec/x86/dcadsp.asm -libavcodec/x86/dcadsp_init.c -libavcodec/x86/dct32.asm -libavcodec/x86/dirac_dwt.asm -libavcodec/x86/dirac_dwt_init.c -libavcodec/x86/diracdsp.asm -libavcodec/x86/diracdsp_init.c -libavcodec/x86/dnxhdenc.asm -libavcodec/x86/dnxhdenc_init.c -libavcodec/x86/exrdsp.asm -libavcodec/x86/exrdsp_init.c -libavcodec/x86/fdct.c -libavcodec/x86/fdct.h -libavcodec/x86/fdctdsp_init.c -libavcodec/x86/flac_dsp_gpl.asm -libavcodec/x86/flacdsp.asm -libavcodec/x86/flacdsp_init.c -libavcodec/x86/flacencdsp_init.c -libavcodec/x86/fmtconvert.asm -libavcodec/x86/fmtconvert_init.c -libavcodec/x86/fpel.asm -libavcodec/x86/fpel.h -libavcodec/x86/g722dsp.asm -libavcodec/x86/g722dsp_init.c -libavcodec/x86/h263_loopfilter.asm -libavcodec/x86/h263dsp_init.c -libavcodec/x86/h264_cabac.c -libavcodec/x86/h264_chromamc.asm -libavcodec/x86/h264_chromamc_10bit.asm -libavcodec/x86/h264_deblock.asm -libavcodec/x86/h264_deblock_10bit.asm -libavcodec/x86/h264_idct.asm -libavcodec/x86/h264_idct_10bit.asm -libavcodec/x86/h264_intrapred.asm -libavcodec/x86/h264_intrapred_10bit.asm -libavcodec/x86/h264_intrapred_init.c -libavcodec/x86/h264_qpel.c -libavcodec/x86/h264_qpel_10bit.asm -libavcodec/x86/h264_qpel_8bit.asm -libavcodec/x86/h264_weight.asm -libavcodec/x86/h264_weight_10bit.asm -libavcodec/x86/h264chroma_init.c -libavcodec/x86/h264dsp_init.c -libavcodec/x86/h26x/h2656_inter.asm -libavcodec/x86/h26x/h2656dsp.c -libavcodec/x86/h26x/h2656dsp.h -libavcodec/x86/hpeldsp.asm -libavcodec/x86/hpeldsp.h -libavcodec/x86/hpeldsp_init.c -libavcodec/x86/hpeldsp_rnd_template.c -libavcodec/x86/huffyuvdsp.asm -libavcodec/x86/huffyuvdsp_init.c -libavcodec/x86/huffyuvdsp_template.asm -libavcodec/x86/huffyuvencdsp.asm -libavcodec/x86/huffyuvencdsp_init.c -libavcodec/x86/idctdsp.asm -libavcodec/x86/idctdsp.h -libavcodec/x86/idctdsp_init.c -libavcodec/x86/imdct36.asm -libavcodec/x86/inline_asm.h -libavcodec/x86/jpeg2000dsp.asm -libavcodec/x86/jpeg2000dsp_init.c -libavcodec/x86/lossless_audiodsp.asm -libavcodec/x86/lossless_audiodsp_init.c -libavcodec/x86/lossless_videodsp.asm -libavcodec/x86/lossless_videodsp_init.c -libavcodec/x86/lossless_videoencdsp.asm -libavcodec/x86/lossless_videoencdsp_init.c -libavcodec/x86/lpc.asm -libavcodec/x86/lpc_init.c -libavcodec/x86/mathops.h -libavcodec/x86/me_cmp.asm -libavcodec/x86/me_cmp_init.c -libavcodec/x86/mlpdsp.asm -libavcodec/x86/mlpdsp_init.c -libavcodec/x86/mpeg4videodsp.c -libavcodec/x86/mpegaudiodsp.c -libavcodec/x86/mpegvideo.c -libavcodec/x86/mpegvideoenc.c -libavcodec/x86/mpegvideoenc_qns_template.c -libavcodec/x86/mpegvideoenc_template.c -libavcodec/x86/mpegvideoencdsp.asm -libavcodec/x86/mpegvideoencdsp_init.c -libavcodec/x86/opusdsp.asm -libavcodec/x86/opusdsp_init.c -libavcodec/x86/pixblockdsp.asm -libavcodec/x86/pixblockdsp_init.c -libavcodec/x86/pngdsp.asm -libavcodec/x86/pngdsp_init.c -libavcodec/x86/qpel.asm -libavcodec/x86/qpeldsp.asm -libavcodec/x86/qpeldsp_init.c -libavcodec/x86/rnd_template.c -libavcodec/x86/sbcdsp.asm -libavcodec/x86/sbcdsp_init.c -libavcodec/x86/sbrdsp.asm -libavcodec/x86/sbrdsp_init.c -libavcodec/x86/simple_idct.asm -libavcodec/x86/simple_idct.h -libavcodec/x86/simple_idct10.asm -libavcodec/x86/simple_idct10_template.asm -libavcodec/x86/snowdsp.c -libavcodec/x86/svq1enc.asm -libavcodec/x86/svq1enc_init.c -libavcodec/x86/synth_filter.asm -libavcodec/x86/synth_filter_init.c -libavcodec/x86/takdsp.asm -libavcodec/x86/takdsp_init.c -libavcodec/x86/ttadsp.asm -libavcodec/x86/ttadsp_init.c -libavcodec/x86/ttaencdsp.asm -libavcodec/x86/ttaencdsp_init.c -libavcodec/x86/utvideodsp.asm -libavcodec/x86/utvideodsp_init.c -libavcodec/x86/v210-init.c -libavcodec/x86/v210.asm -libavcodec/x86/v210enc.asm -libavcodec/x86/v210enc_init.c -libavcodec/x86/vc1dsp.h -libavcodec/x86/vc1dsp_init.c -libavcodec/x86/vc1dsp_loopfilter.asm -libavcodec/x86/vc1dsp_mc.asm -libavcodec/x86/vc1dsp_mmx.c -libavcodec/x86/videodsp.asm -libavcodec/x86/videodsp_init.c -libavcodec/x86/vorbisdsp.asm -libavcodec/x86/vorbisdsp_init.c -libavcodec/x86/vp3dsp.asm -libavcodec/x86/vp3dsp_init.c -libavcodec/x86/vp6dsp.asm -libavcodec/x86/vp6dsp_init.c -libavcodec/x86/vp8dsp.asm -libavcodec/x86/vp8dsp_init.c -libavcodec/x86/vp8dsp_loopfilter.asm -libavcodec/x86/vp9dsp_init.c -libavcodec/x86/vp9dsp_init.h -libavcodec/x86/vp9dsp_init_10bpp.c -libavcodec/x86/vp9dsp_init_12bpp.c -libavcodec/x86/vp9dsp_init_16bpp.c -libavcodec/x86/vp9dsp_init_16bpp_template.c -libavcodec/x86/vp9intrapred.asm -libavcodec/x86/vp9intrapred_16bpp.asm -libavcodec/x86/vp9itxfm.asm -libavcodec/x86/vp9itxfm_16bpp.asm -libavcodec/x86/vp9itxfm_template.asm -libavcodec/x86/vp9lpf.asm -libavcodec/x86/vp9lpf_16bpp.asm -libavcodec/x86/vp9mc.asm -libavcodec/x86/vp9mc_16bpp.asm -libavcodec/x86/vpx_arith.h -libavcodec/x86/vvc/Makefile -libavcodec/x86/vvc/vvc_mc.asm -libavcodec/x86/vvc/vvcdsp_init.c -libavcodec/x86/w64xmmtest.c -libavcodec/x86/xvididct.asm -libavcodec/x86/xvididct.h -libavcodec/x86/xvididct_init.c -libavcodec/xan.c -libavcodec/xbm_parser.c -libavcodec/xbmdec.c -libavcodec/xbmenc.c -libavcodec/xface.c -libavcodec/xface.h -libavcodec/xfacedec.c -libavcodec/xfaceenc.c -libavcodec/xiph.c -libavcodec/xiph.h -libavcodec/xl.c -libavcodec/xma_parser.c -libavcodec/xpmdec.c -libavcodec/xsubdec.c -libavcodec/xsubenc.c -libavcodec/xvididct.c -libavcodec/xvididct.h -libavcodec/xwd.h -libavcodec/xwd_parser.c -libavcodec/xwddec.c -libavcodec/xwdenc.c -libavcodec/xxan.c -libavcodec/y41pdec.c -libavcodec/y41penc.c -libavcodec/ylc.c -libavcodec/yop.c -libavcodec/yuv4dec.c -libavcodec/yuv4enc.c -libavcodec/zerocodec.c -libavcodec/zlib_wrapper.c -libavcodec/zlib_wrapper.h -libavcodec/zmbv.c -libavcodec/zmbvenc.c -libavdevice/Makefile -libavdevice/alldevices.c -libavdevice/alsa.c -libavdevice/alsa.h -libavdevice/alsa_dec.c -libavdevice/alsa_enc.c -libavdevice/avdevice.c -libavdevice/avdevice.h -libavdevice/caca.c -libavdevice/decklink_common.h -libavdevice/decklink_common_c.h -libavdevice/decklink_dec.h -libavdevice/decklink_enc.h -libavdevice/dshow_capture.h -libavdevice/fbdev_common.c -libavdevice/fbdev_common.h -libavdevice/fbdev_dec.c -libavdevice/fbdev_enc.c -libavdevice/iec61883.c -libavdevice/internal.h -libavdevice/jack.c -libavdevice/kmsgrab.c -libavdevice/lavfi.c -libavdevice/libavdevice.v -libavdevice/libcdio.c -libavdevice/libdc1394.c -libavdevice/openal-dec.c -libavdevice/opengl_enc.c -libavdevice/opengl_enc_shaders.h -libavdevice/oss.c -libavdevice/oss.h -libavdevice/oss_dec.c -libavdevice/oss_enc.c -libavdevice/pulse_audio_common.c -libavdevice/pulse_audio_common.h -libavdevice/pulse_audio_dec.c -libavdevice/pulse_audio_enc.c -libavdevice/riscv/Makefile -libavdevice/riscv/cpu_common.c -libavdevice/sdl2.c -libavdevice/sndio.h -libavdevice/timefilter.c -libavdevice/timefilter.h -libavdevice/utils.c -libavdevice/v4l2-common.c -libavdevice/v4l2-common.h -libavdevice/v4l2.c -libavdevice/v4l2enc.c -libavdevice/version.c -libavdevice/version.h -libavdevice/version_major.h -libavdevice/xcbgrab.c -libavdevice/xv.c -libavfilter/Makefile -libavfilter/aap_template.c -libavfilter/aarch64/Makefile -libavfilter/aarch64/vf_bwdif_init_aarch64.c -libavfilter/aarch64/vf_bwdif_neon.S -libavfilter/aarch64/vf_nlmeans_init.c -libavfilter/aarch64/vf_nlmeans_neon.S -libavfilter/adynamicequalizer_template.c -libavfilter/aeval.c -libavfilter/af_aap.c -libavfilter/af_acontrast.c -libavfilter/af_acopy.c -libavfilter/af_acrossover.c -libavfilter/af_acrusher.c -libavfilter/af_adeclick.c -libavfilter/af_adecorrelate.c -libavfilter/af_adelay.c -libavfilter/af_adenorm.c -libavfilter/af_aderivative.c -libavfilter/af_adrc.c -libavfilter/af_adynamicequalizer.c -libavfilter/af_adynamicsmooth.c -libavfilter/af_aecho.c -libavfilter/af_aemphasis.c -libavfilter/af_aexciter.c -libavfilter/af_afade.c -libavfilter/af_afftdn.c -libavfilter/af_afftfilt.c -libavfilter/af_afir.c -libavfilter/af_afirdsp.h -libavfilter/af_aformat.c -libavfilter/af_afreqshift.c -libavfilter/af_afwtdn.c -libavfilter/af_agate.c -libavfilter/af_aiir.c -libavfilter/af_alimiter.c -libavfilter/af_amerge.c -libavfilter/af_amix.c -libavfilter/af_amultiply.c -libavfilter/af_anequalizer.c -libavfilter/af_anlmdn.c -libavfilter/af_anlmdndsp.h -libavfilter/af_anlms.c -libavfilter/af_anull.c -libavfilter/af_apad.c -libavfilter/af_aphaser.c -libavfilter/af_apsyclip.c -libavfilter/af_apulsator.c -libavfilter/af_aresample.c -libavfilter/af_arls.c -libavfilter/af_arnndn.c -libavfilter/af_asdr.c -libavfilter/af_asetnsamples.c -libavfilter/af_asetrate.c -libavfilter/af_ashowinfo.c -libavfilter/af_asoftclip.c -libavfilter/af_aspectralstats.c -libavfilter/af_astats.c -libavfilter/af_asubboost.c -libavfilter/af_asupercut.c -libavfilter/af_atempo.c -libavfilter/af_atilt.c -libavfilter/af_axcorrelate.c -libavfilter/af_biquads.c -libavfilter/af_bs2b.c -libavfilter/af_channelmap.c -libavfilter/af_channelsplit.c -libavfilter/af_chorus.c -libavfilter/af_compand.c -libavfilter/af_compensationdelay.c -libavfilter/af_crossfeed.c -libavfilter/af_crystalizer.c -libavfilter/af_dcshift.c -libavfilter/af_deesser.c -libavfilter/af_dialoguenhance.c -libavfilter/af_drmeter.c -libavfilter/af_dynaudnorm.c -libavfilter/af_earwax.c -libavfilter/af_extrastereo.c -libavfilter/af_firequalizer.c -libavfilter/af_flanger.c -libavfilter/af_haas.c -libavfilter/af_hdcd.c -libavfilter/af_headphone.c -libavfilter/af_join.c -libavfilter/af_ladspa.c -libavfilter/af_loudnorm.c -libavfilter/af_lv2.c -libavfilter/af_mcompand.c -libavfilter/af_pan.c -libavfilter/af_replaygain.c -libavfilter/af_rubberband.c -libavfilter/af_sidechaincompress.c -libavfilter/af_silencedetect.c -libavfilter/af_silenceremove.c -libavfilter/af_sofalizer.c -libavfilter/af_speechnorm.c -libavfilter/af_stereotools.c -libavfilter/af_stereowiden.c -libavfilter/af_superequalizer.c -libavfilter/af_surround.c -libavfilter/af_tremolo.c -libavfilter/af_vibrato.c -libavfilter/af_virtualbass.c -libavfilter/af_volume.c -libavfilter/af_volume.h -libavfilter/af_volumedetect.c -libavfilter/afir_template.c -libavfilter/allfilters.c -libavfilter/anlms_template.c -libavfilter/arls_template.c -libavfilter/asink_anullsink.c -libavfilter/asrc_afdelaysrc.c -libavfilter/asrc_afirsrc.c -libavfilter/asrc_anoisesrc.c -libavfilter/asrc_anullsrc.c -libavfilter/asrc_flite.c -libavfilter/asrc_hilbert.c -libavfilter/asrc_sinc.c -libavfilter/asrc_sine.c -libavfilter/atadenoise.h -libavfilter/audio.c -libavfilter/audio.h -libavfilter/avf_a3dscope.c -libavfilter/avf_abitscope.c -libavfilter/avf_ahistogram.c -libavfilter/avf_aphasemeter.c -libavfilter/avf_avectorscope.c -libavfilter/avf_concat.c -libavfilter/avf_showcqt.c -libavfilter/avf_showcqt.h -libavfilter/avf_showcwt.c -libavfilter/avf_showfreqs.c -libavfilter/avf_showspatial.c -libavfilter/avf_showspectrum.c -libavfilter/avf_showvolume.c -libavfilter/avf_showwaves.c -libavfilter/avfilter.c -libavfilter/avfilter.h -libavfilter/avfilter_internal.h -libavfilter/avfiltergraph.c -libavfilter/bbox.c -libavfilter/bbox.h -libavfilter/blend.h -libavfilter/blend_modes.c -libavfilter/boxblur.c -libavfilter/boxblur.h -libavfilter/bufferqueue.h -libavfilter/buffersink.c -libavfilter/buffersink.h -libavfilter/buffersrc.c -libavfilter/buffersrc.h -libavfilter/bwdifdsp.c -libavfilter/bwdifdsp.h -libavfilter/ccfifo.c -libavfilter/ccfifo.h -libavfilter/colorchannelmixer_template.c -libavfilter/colorspace.c -libavfilter/colorspace.h -libavfilter/colorspacedsp.c -libavfilter/colorspacedsp.h -libavfilter/colorspacedsp_template.c -libavfilter/colorspacedsp_yuv2yuv_template.c -libavfilter/convolution.h -libavfilter/dialoguenhance_template.c -libavfilter/dnn/Makefile -libavfilter/dnn/dnn_backend_common.c -libavfilter/dnn/dnn_backend_common.h -libavfilter/dnn/dnn_backend_torch.cpp -libavfilter/dnn/dnn_interface.c -libavfilter/dnn/dnn_io_proc.c -libavfilter/dnn/dnn_io_proc.h -libavfilter/dnn/queue.c -libavfilter/dnn/queue.h -libavfilter/dnn/safe_queue.c -libavfilter/dnn/safe_queue.h -libavfilter/dnn_filter_common.c -libavfilter/dnn_filter_common.h -libavfilter/dnn_interface.h -libavfilter/drawutils.c -libavfilter/drawutils.h -libavfilter/ebur128.c -libavfilter/ebur128.h -libavfilter/edge_common.c -libavfilter/edge_common.h -libavfilter/edge_template.c -libavfilter/f_bench.c -libavfilter/f_cue.c -libavfilter/f_drawgraph.c -libavfilter/f_ebur128.c -libavfilter/f_graphmonitor.c -libavfilter/f_interleave.c -libavfilter/f_latency.c -libavfilter/f_loop.c -libavfilter/f_metadata.c -libavfilter/f_perms.c -libavfilter/f_realtime.c -libavfilter/f_reverse.c -libavfilter/f_segment.c -libavfilter/f_select.c -libavfilter/f_sendcmd.c -libavfilter/f_sidedata.c -libavfilter/f_streamselect.c -libavfilter/f_zmq.c -libavfilter/fflcms2.c -libavfilter/fflcms2.h -libavfilter/filters.h -libavfilter/formats.c -libavfilter/formats.h -libavfilter/framepool.c -libavfilter/framepool.h -libavfilter/framequeue.c -libavfilter/framequeue.h -libavfilter/framerate.h -libavfilter/framesync.c -libavfilter/framesync.h -libavfilter/gblur.h -libavfilter/generate_wave_table.c -libavfilter/generate_wave_table.h -libavfilter/gradfun.h -libavfilter/graphdump.c -libavfilter/graphparser.c -libavfilter/hermite.h -libavfilter/hflip.h -libavfilter/lavfutils.c -libavfilter/lavfutils.h -libavfilter/libavfilter.v -libavfilter/limiter.h -libavfilter/log2_tab.c -libavfilter/lswsutils.c -libavfilter/lswsutils.h -libavfilter/lut3d.h -libavfilter/maskedclamp.h -libavfilter/maskedmerge.h -libavfilter/median.h -libavfilter/median_template.c -libavfilter/motion_estimation.c -libavfilter/motion_estimation.h -libavfilter/opencl.c -libavfilter/opencl.h -libavfilter/opencl/avgblur.cl -libavfilter/opencl/colorkey.cl -libavfilter/opencl/colorspace_common.cl -libavfilter/opencl/convolution.cl -libavfilter/opencl/deshake.cl -libavfilter/opencl/neighbor.cl -libavfilter/opencl/nlmeans.cl -libavfilter/opencl/overlay.cl -libavfilter/opencl/pad.cl -libavfilter/opencl/remap.cl -libavfilter/opencl/tonemap.cl -libavfilter/opencl/transpose.cl -libavfilter/opencl/unsharp.cl -libavfilter/opencl/xfade.cl -libavfilter/opencl_source.h -libavfilter/palette.c -libavfilter/palette.h -libavfilter/perlin.c -libavfilter/perlin.h -libavfilter/phase_template.c -libavfilter/preserve_color.h -libavfilter/psnr.h -libavfilter/pthread.c -libavfilter/qp_table.c -libavfilter/qp_table.h -libavfilter/qrencode.c -libavfilter/qsvvpp.c -libavfilter/qsvvpp.h -libavfilter/removegrain.h -libavfilter/riscv/Makefile -libavfilter/riscv/af_afir_init.c -libavfilter/riscv/af_afir_rvv.S -libavfilter/riscv/cpu_common.c -libavfilter/scale_eval.c -libavfilter/scale_eval.h -libavfilter/scene_sad.c -libavfilter/scene_sad.h -libavfilter/setpts.c -libavfilter/settb.c -libavfilter/signature.h -libavfilter/signature_lookup.c -libavfilter/silenceremove_template.c -libavfilter/split.c -libavfilter/src_avsynctest.c -libavfilter/src_movie.c -libavfilter/ssim.h -libavfilter/stack_internal.c -libavfilter/stack_internal.h -libavfilter/stereo3d.h -libavfilter/textutils.c -libavfilter/textutils.h -libavfilter/threshold.h -libavfilter/tinterlace.h -libavfilter/transform.c -libavfilter/transform.h -libavfilter/transpose.h -libavfilter/trim.c -libavfilter/v360.h -libavfilter/vaapi_vpp.c -libavfilter/vaapi_vpp.h -libavfilter/vaf_spectrumsynth.c -libavfilter/version.c -libavfilter/version.h -libavfilter/version_major.h -libavfilter/vf_addroi.c -libavfilter/vf_alphamerge.c -libavfilter/vf_amplify.c -libavfilter/vf_aspect.c -libavfilter/vf_atadenoise.c -libavfilter/vf_avgblur.c -libavfilter/vf_avgblur_opencl.c -libavfilter/vf_avgblur_vulkan.c -libavfilter/vf_backgroundkey.c -libavfilter/vf_bbox.c -libavfilter/vf_bilateral.c -libavfilter/vf_bitplanenoise.c -libavfilter/vf_blackdetect.c -libavfilter/vf_blackframe.c -libavfilter/vf_blend.c -libavfilter/vf_blend_init.h -libavfilter/vf_blend_vulkan.c -libavfilter/vf_blockdetect.c -libavfilter/vf_blurdetect.c -libavfilter/vf_bm3d.c -libavfilter/vf_boxblur.c -libavfilter/vf_bwdif.c -libavfilter/vf_bwdif_vulkan.c -libavfilter/vf_cas.c -libavfilter/vf_ccrepack.c -libavfilter/vf_chromaber_vulkan.c -libavfilter/vf_chromakey.c -libavfilter/vf_chromanr.c -libavfilter/vf_chromashift.c -libavfilter/vf_ciescope.c -libavfilter/vf_codecview.c -libavfilter/vf_colorbalance.c -libavfilter/vf_colorchannelmixer.c -libavfilter/vf_colorconstancy.c -libavfilter/vf_colorcontrast.c -libavfilter/vf_colorcorrect.c -libavfilter/vf_colorize.c -libavfilter/vf_colorkey.c -libavfilter/vf_colorkey_opencl.c -libavfilter/vf_colorlevels.c -libavfilter/vf_colormap.c -libavfilter/vf_colormatrix.c -libavfilter/vf_colorspace.c -libavfilter/vf_colortemperature.c -libavfilter/vf_convolution.c -libavfilter/vf_convolution_opencl.c -libavfilter/vf_convolve.c -libavfilter/vf_copy.c -libavfilter/vf_corr.c -libavfilter/vf_cover_rect.c -libavfilter/vf_crop.c -libavfilter/vf_cropdetect.c -libavfilter/vf_curves.c -libavfilter/vf_datascope.c -libavfilter/vf_dblur.c -libavfilter/vf_dctdnoiz.c -libavfilter/vf_deband.c -libavfilter/vf_deblock.c -libavfilter/vf_decimate.c -libavfilter/vf_dedot.c -libavfilter/vf_deflicker.c -libavfilter/vf_deinterlace_vaapi.c -libavfilter/vf_dejudder.c -libavfilter/vf_delogo.c -libavfilter/vf_derain.c -libavfilter/vf_deshake.c -libavfilter/vf_deshake_opencl.c -libavfilter/vf_despill.c -libavfilter/vf_detelecine.c -libavfilter/vf_displace.c -libavfilter/vf_dnn_classify.c -libavfilter/vf_dnn_detect.c -libavfilter/vf_dnn_processing.c -libavfilter/vf_drawbox.c -libavfilter/vf_drawbox_vaapi.c -libavfilter/vf_drawtext.c -libavfilter/vf_edgedetect.c -libavfilter/vf_elbg.c -libavfilter/vf_entropy.c -libavfilter/vf_epx.c -libavfilter/vf_eq.c -libavfilter/vf_eq.h -libavfilter/vf_estdif.c -libavfilter/vf_exposure.c -libavfilter/vf_extractplanes.c -libavfilter/vf_fade.c -libavfilter/vf_feedback.c -libavfilter/vf_fftdnoiz.c -libavfilter/vf_fftfilt.c -libavfilter/vf_field.c -libavfilter/vf_fieldhint.c -libavfilter/vf_fieldmatch.c -libavfilter/vf_fieldorder.c -libavfilter/vf_fillborders.c -libavfilter/vf_find_rect.c -libavfilter/vf_flip_vulkan.c -libavfilter/vf_floodfill.c -libavfilter/vf_format.c -libavfilter/vf_fps.c -libavfilter/vf_framepack.c -libavfilter/vf_framerate.c -libavfilter/vf_framestep.c -libavfilter/vf_freezedetect.c -libavfilter/vf_freezeframes.c -libavfilter/vf_frei0r.c -libavfilter/vf_fspp.c -libavfilter/vf_fspp.h -libavfilter/vf_fsync.c -libavfilter/vf_gblur.c -libavfilter/vf_gblur_init.h -libavfilter/vf_gblur_vulkan.c -libavfilter/vf_geq.c -libavfilter/vf_gradfun.c -libavfilter/vf_grayworld.c -libavfilter/vf_guided.c -libavfilter/vf_hflip.c -libavfilter/vf_hflip_init.h -libavfilter/vf_histeq.c -libavfilter/vf_histogram.c -libavfilter/vf_hqdn3d.c -libavfilter/vf_hqdn3d.h -libavfilter/vf_hqx.c -libavfilter/vf_hsvkey.c -libavfilter/vf_hue.c -libavfilter/vf_huesaturation.c -libavfilter/vf_hwdownload.c -libavfilter/vf_hwmap.c -libavfilter/vf_hwupload.c -libavfilter/vf_hwupload_cuda.c -libavfilter/vf_hysteresis.c -libavfilter/vf_iccdetect.c -libavfilter/vf_iccgen.c -libavfilter/vf_identity.c -libavfilter/vf_idet.c -libavfilter/vf_idet.h -libavfilter/vf_il.c -libavfilter/vf_kerndeint.c -libavfilter/vf_lagfun.c -libavfilter/vf_lenscorrection.c -libavfilter/vf_libplacebo.c -libavfilter/vf_libvmaf.c -libavfilter/vf_limitdiff.c -libavfilter/vf_limiter.c -libavfilter/vf_lumakey.c -libavfilter/vf_lut.c -libavfilter/vf_lut2.c -libavfilter/vf_lut3d.c -libavfilter/vf_maskedclamp.c -libavfilter/vf_maskedmerge.c -libavfilter/vf_maskedminmax.c -libavfilter/vf_maskedthreshold.c -libavfilter/vf_maskfun.c -libavfilter/vf_mcdeint.c -libavfilter/vf_median.c -libavfilter/vf_mergeplanes.c -libavfilter/vf_mestimate.c -libavfilter/vf_midequalizer.c -libavfilter/vf_minterpolate.c -libavfilter/vf_misc_vaapi.c -libavfilter/vf_mix.c -libavfilter/vf_monochrome.c -libavfilter/vf_morpho.c -libavfilter/vf_mpdecimate.c -libavfilter/vf_multiply.c -libavfilter/vf_negate.c -libavfilter/vf_neighbor.c -libavfilter/vf_neighbor_opencl.c -libavfilter/vf_nlmeans.c -libavfilter/vf_nlmeans.h -libavfilter/vf_nlmeans_init.h -libavfilter/vf_nlmeans_opencl.c -libavfilter/vf_nlmeans_vulkan.c -libavfilter/vf_nnedi.c -libavfilter/vf_noise.c -libavfilter/vf_noise.h -libavfilter/vf_normalize.c -libavfilter/vf_null.c -libavfilter/vf_ocr.c -libavfilter/vf_overlay.c -libavfilter/vf_overlay.h -libavfilter/vf_overlay_opencl.c -libavfilter/vf_overlay_qsv.c -libavfilter/vf_overlay_vaapi.c -libavfilter/vf_overlay_vulkan.c -libavfilter/vf_owdenoise.c -libavfilter/vf_pad.c -libavfilter/vf_pad_opencl.c -libavfilter/vf_pad_vaapi.c -libavfilter/vf_palettegen.c -libavfilter/vf_paletteuse.c -libavfilter/vf_perspective.c -libavfilter/vf_phase.c -libavfilter/vf_photosensitivity.c -libavfilter/vf_pixdesctest.c -libavfilter/vf_pixelize.c -libavfilter/vf_pp.c -libavfilter/vf_pp7.c -libavfilter/vf_pp7.h -libavfilter/vf_premultiply.c -libavfilter/vf_procamp_vaapi.c -libavfilter/vf_program_opencl.c -libavfilter/vf_pseudocolor.c -libavfilter/vf_psnr.c -libavfilter/vf_pullup.c -libavfilter/vf_pullup.h -libavfilter/vf_qp.c -libavfilter/vf_quirc.c -libavfilter/vf_random.c -libavfilter/vf_readeia608.c -libavfilter/vf_readvitc.c -libavfilter/vf_remap.c -libavfilter/vf_remap_opencl.c -libavfilter/vf_removegrain.c -libavfilter/vf_removelogo.c -libavfilter/vf_repeatfields.c -libavfilter/vf_rotate.c -libavfilter/vf_sab.c -libavfilter/vf_scale.c -libavfilter/vf_scale_cuda.h -libavfilter/vf_scale_vaapi.c -libavfilter/vf_scale_vulkan.c -libavfilter/vf_scdet.c -libavfilter/vf_scroll.c -libavfilter/vf_selectivecolor.c -libavfilter/vf_separatefields.c -libavfilter/vf_setparams.c -libavfilter/vf_shear.c -libavfilter/vf_showinfo.c -libavfilter/vf_showpalette.c -libavfilter/vf_shuffleframes.c -libavfilter/vf_shufflepixels.c -libavfilter/vf_shuffleplanes.c -libavfilter/vf_signalstats.c -libavfilter/vf_signature.c -libavfilter/vf_siti.c -libavfilter/vf_smartblur.c -libavfilter/vf_spp.c -libavfilter/vf_spp.h -libavfilter/vf_sr.c -libavfilter/vf_ssim.c -libavfilter/vf_ssim360.c -libavfilter/vf_stack.c -libavfilter/vf_stack_qsv.c -libavfilter/vf_stack_vaapi.c -libavfilter/vf_stereo3d.c -libavfilter/vf_subtitles.c -libavfilter/vf_super2xsai.c -libavfilter/vf_swaprect.c -libavfilter/vf_swapuv.c -libavfilter/vf_telecine.c -libavfilter/vf_threshold.c -libavfilter/vf_threshold_init.h -libavfilter/vf_thumbnail.c -libavfilter/vf_tile.c -libavfilter/vf_tiltandshift.c -libavfilter/vf_tinterlace.c -libavfilter/vf_tmidequalizer.c -libavfilter/vf_tonemap.c -libavfilter/vf_tonemap_opencl.c -libavfilter/vf_tonemap_vaapi.c -libavfilter/vf_tpad.c -libavfilter/vf_transpose.c -libavfilter/vf_transpose_opencl.c -libavfilter/vf_transpose_vaapi.c -libavfilter/vf_transpose_vulkan.c -libavfilter/vf_unsharp.c -libavfilter/vf_unsharp_opencl.c -libavfilter/vf_untile.c -libavfilter/vf_uspp.c -libavfilter/vf_v360.c -libavfilter/vf_vaguedenoiser.c -libavfilter/vf_varblur.c -libavfilter/vf_vectorscope.c -libavfilter/vf_vflip.c -libavfilter/vf_vfrdet.c -libavfilter/vf_vibrance.c -libavfilter/vf_vidstabdetect.c -libavfilter/vf_vidstabtransform.c -libavfilter/vf_vif.c -libavfilter/vf_vignette.c -libavfilter/vf_vmafmotion.c -libavfilter/vf_vpp_qsv.c -libavfilter/vf_w3fdif.c -libavfilter/vf_waveform.c -libavfilter/vf_weave.c -libavfilter/vf_xbr.c -libavfilter/vf_xfade.c -libavfilter/vf_xfade_opencl.c -libavfilter/vf_xfade_vulkan.c -libavfilter/vf_xmedian.c -libavfilter/vf_xpsnr.c -libavfilter/vf_yadif.c -libavfilter/vf_yaepblur.c -libavfilter/vf_zoompan.c -libavfilter/vf_zscale.c -libavfilter/video.c -libavfilter/video.h -libavfilter/vidstabutils.c -libavfilter/vidstabutils.h -libavfilter/vmaf_motion.h -libavfilter/vsink_nullsink.c -libavfilter/vsrc_cellauto.c -libavfilter/vsrc_gradients.c -libavfilter/vsrc_life.c -libavfilter/vsrc_mandelbrot.c -libavfilter/vsrc_mptestsrc.c -libavfilter/vsrc_perlin.c -libavfilter/vsrc_sierpinski.c -libavfilter/vsrc_testsrc.c -libavfilter/vsrc_testsrc_vulkan.c -libavfilter/vulkan.c -libavfilter/vulkan.h -libavfilter/vulkan_filter.c -libavfilter/vulkan_filter.h -libavfilter/vulkan_shaderc.c -libavfilter/vulkan_spirv.h -libavfilter/w3fdif.h -libavfilter/window_func.h -libavfilter/x86/Makefile -libavfilter/x86/af_afir.asm -libavfilter/x86/af_afir_init.c -libavfilter/x86/af_anlmdn.asm -libavfilter/x86/af_anlmdn_init.c -libavfilter/x86/af_volume.asm -libavfilter/x86/af_volume_init.c -libavfilter/x86/avf_showcqt.asm -libavfilter/x86/avf_showcqt_init.c -libavfilter/x86/colorspacedsp.asm -libavfilter/x86/colorspacedsp_init.c -libavfilter/x86/scene_sad.asm -libavfilter/x86/scene_sad_init.c -libavfilter/x86/vf_atadenoise.asm -libavfilter/x86/vf_atadenoise_init.c -libavfilter/x86/vf_blend.asm -libavfilter/x86/vf_blend_init.c -libavfilter/x86/vf_bwdif.asm -libavfilter/x86/vf_bwdif_init.c -libavfilter/x86/vf_convolution.asm -libavfilter/x86/vf_convolution_init.c -libavfilter/x86/vf_eq.asm -libavfilter/x86/vf_eq_init.c -libavfilter/x86/vf_framerate.asm -libavfilter/x86/vf_framerate_init.c -libavfilter/x86/vf_fspp.asm -libavfilter/x86/vf_fspp_init.c -libavfilter/x86/vf_gblur.asm -libavfilter/x86/vf_gblur_init.c -libavfilter/x86/vf_gradfun.asm -libavfilter/x86/vf_gradfun_init.c -libavfilter/x86/vf_hflip.asm -libavfilter/x86/vf_hflip_init.c -libavfilter/x86/vf_hqdn3d.asm -libavfilter/x86/vf_hqdn3d_init.c -libavfilter/x86/vf_idet.asm -libavfilter/x86/vf_idet_init.c -libavfilter/x86/vf_interlace.asm -libavfilter/x86/vf_limiter.asm -libavfilter/x86/vf_limiter_init.c -libavfilter/x86/vf_lut3d.asm -libavfilter/x86/vf_lut3d_init.c -libavfilter/x86/vf_maskedclamp.asm -libavfilter/x86/vf_maskedclamp_init.c -libavfilter/x86/vf_maskedmerge.asm -libavfilter/x86/vf_maskedmerge_init.c -libavfilter/x86/vf_nlmeans.asm -libavfilter/x86/vf_nlmeans_init.c -libavfilter/x86/vf_noise.c -libavfilter/x86/vf_overlay.asm -libavfilter/x86/vf_overlay_init.c -libavfilter/x86/vf_pp7.asm -libavfilter/x86/vf_pp7_init.c -libavfilter/x86/vf_psnr.asm -libavfilter/x86/vf_psnr_init.c -libavfilter/x86/vf_pullup.asm -libavfilter/x86/vf_pullup_init.c -libavfilter/x86/vf_removegrain.asm -libavfilter/x86/vf_removegrain_init.c -libavfilter/x86/vf_spp.c -libavfilter/x86/vf_ssim.asm -libavfilter/x86/vf_ssim_init.c -libavfilter/x86/vf_stereo3d.asm -libavfilter/x86/vf_stereo3d_init.c -libavfilter/x86/vf_threshold.asm -libavfilter/x86/vf_threshold_init.c -libavfilter/x86/vf_tinterlace_init.c -libavfilter/x86/vf_transpose.asm -libavfilter/x86/vf_transpose_init.c -libavfilter/x86/vf_v360.asm -libavfilter/x86/vf_v360_init.c -libavfilter/x86/vf_w3fdif.asm -libavfilter/x86/vf_w3fdif_init.c -libavfilter/x86/vf_xpsnr_init.c -libavfilter/x86/vf_yadif.asm -libavfilter/x86/vf_yadif_init.c -libavfilter/x86/yadif-10.asm -libavfilter/x86/yadif-16.asm -libavfilter/xpsnr.h -libavfilter/yadif.h -libavfilter/yadif_common.c -libavformat/3dostr.c -libavformat/4xm.c -libavformat/Makefile -libavformat/a64.c -libavformat/aacdec.c -libavformat/aadec.c -libavformat/aaxdec.c -libavformat/ac3_channel_layout_tab.c -libavformat/ac3dec.c -libavformat/ac4dec.c -libavformat/ac4enc.c -libavformat/acedec.c -libavformat/acm.c -libavformat/act.c -libavformat/adp.c -libavformat/ads.c -libavformat/adtsenc.c -libavformat/adxdec.c -libavformat/aeadec.c -libavformat/aeaenc.c -libavformat/afc.c -libavformat/aiff.c -libavformat/aiff.h -libavformat/aiffdec.c -libavformat/aiffenc.c -libavformat/aixdec.c -libavformat/allformats.c -libavformat/alp.c -libavformat/amr.c -libavformat/amvenc.c -libavformat/anm.c -libavformat/apac.c -libavformat/apc.c -libavformat/ape.c -libavformat/apetag.c -libavformat/apetag.h -libavformat/apm.c -libavformat/apngdec.c -libavformat/apngenc.c -libavformat/aptxdec.c -libavformat/aqtitledec.c -libavformat/argo_asf.c -libavformat/argo_asf.h -libavformat/argo_brp.c -libavformat/argo_cvg.c -libavformat/asf.c -libavformat/asf.h -libavformat/asf_tags.c -libavformat/asfcrypt.c -libavformat/asfcrypt.h -libavformat/asfdec_f.c -libavformat/asfdec_o.c -libavformat/asfenc.c -libavformat/assdec.c -libavformat/assenc.c -libavformat/ast.c -libavformat/ast.h -libavformat/astdec.c -libavformat/astenc.c -libavformat/async.c -libavformat/au.c -libavformat/av1.c -libavformat/av1.h -libavformat/av1dec.c -libavformat/avc.c -libavformat/avc.h -libavformat/avformat.c -libavformat/avformat.h -libavformat/avi.h -libavformat/avidec.c -libavformat/avienc.c -libavformat/avio.c -libavformat/avio.h -libavformat/avio_internal.h -libavformat/aviobuf.c -libavformat/avlanguage.c -libavformat/avlanguage.h -libavformat/avr.c -libavformat/avs.c -libavformat/avs2dec.c -libavformat/avs3dec.c -libavformat/bethsoftvid.c -libavformat/bfi.c -libavformat/bink.c -libavformat/binka.c -libavformat/bintext.c -libavformat/bit.c -libavformat/bluray.c -libavformat/bmv.c -libavformat/boadec.c -libavformat/bonk.c -libavformat/brstm.c -libavformat/c93.c -libavformat/cache.c -libavformat/caf.c -libavformat/caf.h -libavformat/cafdec.c -libavformat/cafenc.c -libavformat/cavsvideodec.c -libavformat/cdg.c -libavformat/cdxl.c -libavformat/chromaprint.c -libavformat/cinedec.c -libavformat/codec2.c -libavformat/concat.c -libavformat/concatdec.c -libavformat/crcenc.c -libavformat/crypto.c -libavformat/dash.c -libavformat/dash.h -libavformat/dashdec.c -libavformat/dashenc.c -libavformat/data_uri.c -libavformat/dauddec.c -libavformat/daudenc.c -libavformat/dca_sample_rate_tab.c -libavformat/dcstr.c -libavformat/demux.c -libavformat/demux.h -libavformat/demux_utils.c -libavformat/derf.c -libavformat/dfa.c -libavformat/dfpwmdec.c -libavformat/dhav.c -libavformat/diracdec.c -libavformat/dnxhddec.c -libavformat/dovi_isom.c -libavformat/dovi_isom.h -libavformat/dsfdec.c -libavformat/dsicin.c -libavformat/dss.c -libavformat/dtsdec.c -libavformat/dtshddec.c -libavformat/dump.c -libavformat/dv.c -libavformat/dv.h -libavformat/dvbsub.c -libavformat/dvbtxt.c -libavformat/dvdclut.c -libavformat/dvdclut.h -libavformat/dvdvideodec.c -libavformat/dvenc.c -libavformat/dxa.c -libavformat/eacdata.c -libavformat/electronicarts.c -libavformat/epafdec.c -libavformat/evc.c -libavformat/evc.h -libavformat/evcdec.c -libavformat/ffmeta.h -libavformat/ffmetadec.c -libavformat/ffmetaenc.c -libavformat/fifo.c -libavformat/file.c -libavformat/filmstripdec.c -libavformat/filmstripenc.c -libavformat/fitsdec.c -libavformat/fitsenc.c -libavformat/flac_picture.c -libavformat/flac_picture.h -libavformat/flacdec.c -libavformat/flacenc.c -libavformat/flacenc.h -libavformat/flacenc_header.c -libavformat/flic.c -libavformat/flv.h -libavformat/flvdec.c -libavformat/flvenc.c -libavformat/format.c -libavformat/framecrcenc.c -libavformat/framehash.c -libavformat/frmdec.c -libavformat/fsb.c -libavformat/ftp.c -libavformat/fwse.c -libavformat/g722.c -libavformat/g723_1.c -libavformat/g726.c -libavformat/g729dec.c -libavformat/gdv.c -libavformat/genh.c -libavformat/gif.c -libavformat/gifdec.c -libavformat/golomb_tab.c -libavformat/gopher.c -libavformat/gsmdec.c -libavformat/gxf.c -libavformat/gxf.h -libavformat/gxfenc.c -libavformat/h261dec.c -libavformat/h263dec.c -libavformat/h264dec.c -libavformat/hashenc.c -libavformat/hca.c -libavformat/hcom.c -libavformat/hdsenc.c -libavformat/hevc.c -libavformat/hevc.h -libavformat/hevcdec.c -libavformat/hls.c -libavformat/hls_sample_encryption.c -libavformat/hls_sample_encryption.h -libavformat/hlsenc.c -libavformat/hlsplaylist.c -libavformat/hlsplaylist.h -libavformat/hlsproto.c -libavformat/hnm.c -libavformat/http.c -libavformat/http.h -libavformat/httpauth.c -libavformat/httpauth.h -libavformat/iamf.c -libavformat/iamf.h -libavformat/iamf_parse.c -libavformat/iamf_parse.h -libavformat/iamf_reader.c -libavformat/iamf_reader.h -libavformat/iamf_writer.c -libavformat/iamf_writer.h -libavformat/iamfdec.c -libavformat/iamfenc.c -libavformat/icecast.c -libavformat/icodec.c -libavformat/icoenc.c -libavformat/id3v1.c -libavformat/id3v1.h -libavformat/id3v2.c -libavformat/id3v2.h -libavformat/id3v2enc.c -libavformat/idcin.c -libavformat/idroqdec.c -libavformat/idroqenc.c -libavformat/iff.c -libavformat/ifv.c -libavformat/ilbc.c -libavformat/imf.h -libavformat/imf_cpl.c -libavformat/imfdec.c -libavformat/img2.c -libavformat/img2.h -libavformat/img2_alias_pix.c -libavformat/img2_brender_pix.c -libavformat/img2dec.c -libavformat/img2enc.c -libavformat/imx.c -libavformat/ingenientdec.c -libavformat/internal.h -libavformat/ip.c -libavformat/ip.h -libavformat/ipfsgateway.c -libavformat/ipmovie.c -libavformat/ipudec.c -libavformat/ircam.c -libavformat/ircam.h -libavformat/ircamdec.c -libavformat/ircamenc.c -libavformat/isom.c -libavformat/isom.h -libavformat/isom_tags.c -libavformat/iss.c -libavformat/iv8.c -libavformat/ivfdec.c -libavformat/ivfenc.c -libavformat/jacosubdec.c -libavformat/jacosubenc.c -libavformat/jpegtables.c -libavformat/jpegxl_anim_dec.c -libavformat/jpegxl_parse.c -libavformat/jvdec.c -libavformat/kvag.c -libavformat/lafdec.c -libavformat/latmenc.c -libavformat/lc3.c -libavformat/libamqp.c -libavformat/libavformat.v -libavformat/libgme.c -libavformat/libmodplug.c -libavformat/libopenmpt.c -libavformat/librist.c -libavformat/libsmbclient.c -libavformat/libsrt.c -libavformat/libssh.c -libavformat/libzmq.c -libavformat/lmlm4.c -libavformat/loasdec.c -libavformat/log2_tab.c -libavformat/lrc.c -libavformat/lrc.h -libavformat/lrcdec.c -libavformat/lrcenc.c -libavformat/luodatdec.c -libavformat/lvfdec.c -libavformat/lxfdec.c -libavformat/m4vdec.c -libavformat/matroska.c -libavformat/matroska.h -libavformat/matroskadec.c -libavformat/matroskaenc.c -libavformat/mca.c -libavformat/mccdec.c -libavformat/md5proto.c -libavformat/metadata.c -libavformat/metadata.h -libavformat/mgsts.c -libavformat/microdvddec.c -libavformat/microdvdenc.c -libavformat/mj2kdec.c -libavformat/mkvtimestamp_v2.c -libavformat/mlpdec.c -libavformat/mlvdec.c -libavformat/mm.c -libavformat/mmf.c -libavformat/mms.c -libavformat/mms.h -libavformat/mmsh.c -libavformat/mmst.c -libavformat/mods.c -libavformat/moflex.c -libavformat/mov.c -libavformat/mov_chan.c -libavformat/mov_chan.h -libavformat/mov_esds.c -libavformat/movenc.c -libavformat/movenc.h -libavformat/movenc_ttml.c -libavformat/movenc_ttml.h -libavformat/movenccenc.c -libavformat/movenccenc.h -libavformat/movenchint.c -libavformat/mp3dec.c -libavformat/mp3enc.c -libavformat/mpc.c -libavformat/mpc8.c -libavformat/mpeg.c -libavformat/mpeg.h -libavformat/mpeg4audio_sample_rates.c -libavformat/mpegaudiotabs.c -libavformat/mpegenc.c -libavformat/mpegts.c -libavformat/mpegts.h -libavformat/mpegtsenc.c -libavformat/mpegvideodec.c -libavformat/mpjpeg.c -libavformat/mpjpegdec.c -libavformat/mpl2dec.c -libavformat/mpsubdec.c -libavformat/msf.c -libavformat/msnwc_tcp.c -libavformat/mspdec.c -libavformat/mtaf.c -libavformat/mtv.c -libavformat/musx.c -libavformat/mux.c -libavformat/mux.h -libavformat/mux_utils.c -libavformat/mvdec.c -libavformat/mvi.c -libavformat/mxf.c -libavformat/mxf.h -libavformat/mxfdec.c -libavformat/mxfenc.c -libavformat/mxg.c -libavformat/nal.c -libavformat/nal.h -libavformat/ncdec.c -libavformat/network.c -libavformat/network.h -libavformat/nistspheredec.c -libavformat/nspdec.c -libavformat/nsvdec.c -libavformat/nullenc.c -libavformat/nut.c -libavformat/nut.h -libavformat/nutdec.c -libavformat/nutenc.c -libavformat/nuv.c -libavformat/oggdec.c -libavformat/oggdec.h -libavformat/oggenc.c -libavformat/oggparsecelt.c -libavformat/oggparsedirac.c -libavformat/oggparseflac.c -libavformat/oggparseogm.c -libavformat/oggparseopus.c -libavformat/oggparseskeleton.c -libavformat/oggparsespeex.c -libavformat/oggparsetheora.c -libavformat/oggparsevorbis.c -libavformat/oggparsevp8.c -libavformat/oma.c -libavformat/oma.h -libavformat/omadec.c -libavformat/omaenc.c -libavformat/options.c -libavformat/options_table.h -libavformat/os_support.c -libavformat/os_support.h -libavformat/osq.c -libavformat/paf.c -libavformat/pcm.c -libavformat/pcm.h -libavformat/pcmdec.c -libavformat/pcmenc.c -libavformat/pdvdec.c -libavformat/pjsdec.c -libavformat/pmpdec.c -libavformat/pp_bnk.c -libavformat/prompeg.c -libavformat/protocols.c -libavformat/psxstr.c -libavformat/pva.c -libavformat/pvfdec.c -libavformat/qcp.c -libavformat/qoadec.c -libavformat/qtpalette.c -libavformat/qtpalette.h -libavformat/r3d.c -libavformat/rangecoder_dec.c -libavformat/rawdec.c -libavformat/rawdec.h -libavformat/rawenc.c -libavformat/rawenc.h -libavformat/rawutils.c -libavformat/rawutils.h -libavformat/rawvideodec.c -libavformat/rcwtdec.c -libavformat/rcwtenc.c -libavformat/rdt.c -libavformat/rdt.h -libavformat/realtextdec.c -libavformat/redspark.c -libavformat/replaygain.c -libavformat/replaygain.h -libavformat/riff.c -libavformat/riff.h -libavformat/riffdec.c -libavformat/riffenc.c -libavformat/riscv/Makefile -libavformat/riscv/cpu_common.c -libavformat/rka.c -libavformat/rl2.c -libavformat/rm.c -libavformat/rm.h -libavformat/rmdec.c -libavformat/rmenc.c -libavformat/rmsipr.c -libavformat/rmsipr.h -libavformat/rpl.c -libavformat/rsd.c -libavformat/rso.c -libavformat/rso.h -libavformat/rsodec.c -libavformat/rsoenc.c -libavformat/rtmp.h -libavformat/rtmpcrypt.c -libavformat/rtmpcrypt.h -libavformat/rtmpdh.c -libavformat/rtmpdh.h -libavformat/rtmpdigest.c -libavformat/rtmphttp.c -libavformat/rtmppkt.c -libavformat/rtmppkt.h -libavformat/rtmpproto.c -libavformat/rtp.c -libavformat/rtp.h -libavformat/rtpdec.c -libavformat/rtpdec.h -libavformat/rtpdec_ac3.c -libavformat/rtpdec_amr.c -libavformat/rtpdec_asf.c -libavformat/rtpdec_dv.c -libavformat/rtpdec_formats.h -libavformat/rtpdec_g726.c -libavformat/rtpdec_h261.c -libavformat/rtpdec_h263.c -libavformat/rtpdec_h263_rfc2190.c -libavformat/rtpdec_h264.c -libavformat/rtpdec_hevc.c -libavformat/rtpdec_ilbc.c -libavformat/rtpdec_jpeg.c -libavformat/rtpdec_latm.c -libavformat/rtpdec_mpa_robust.c -libavformat/rtpdec_mpeg12.c -libavformat/rtpdec_mpeg4.c -libavformat/rtpdec_mpegts.c -libavformat/rtpdec_qcelp.c -libavformat/rtpdec_qdm2.c -libavformat/rtpdec_qt.c -libavformat/rtpdec_rfc4175.c -libavformat/rtpdec_svq3.c -libavformat/rtpdec_vc2hq.c -libavformat/rtpdec_vp8.c -libavformat/rtpdec_vp9.c -libavformat/rtpdec_xiph.c -libavformat/rtpenc.c -libavformat/rtpenc.h -libavformat/rtpenc_aac.c -libavformat/rtpenc_amr.c -libavformat/rtpenc_chain.c -libavformat/rtpenc_chain.h -libavformat/rtpenc_h261.c -libavformat/rtpenc_h263.c -libavformat/rtpenc_h263_rfc2190.c -libavformat/rtpenc_h264_hevc.c -libavformat/rtpenc_jpeg.c -libavformat/rtpenc_latm.c -libavformat/rtpenc_mpegts.c -libavformat/rtpenc_mpv.c -libavformat/rtpenc_rfc4175.c -libavformat/rtpenc_vc2hq.c -libavformat/rtpenc_vp8.c -libavformat/rtpenc_vp9.c -libavformat/rtpenc_xiph.c -libavformat/rtpproto.c -libavformat/rtpproto.h -libavformat/rtsp.c -libavformat/rtsp.h -libavformat/rtspcodes.h -libavformat/rtspdec.c -libavformat/rtspenc.c -libavformat/s337m.c -libavformat/samidec.c -libavformat/sapdec.c -libavformat/sapenc.c -libavformat/sauce.c -libavformat/sauce.h -libavformat/sbcdec.c -libavformat/sbgdec.c -libavformat/sccdec.c -libavformat/sccenc.c -libavformat/scd.c -libavformat/sdns.c -libavformat/sdp.c -libavformat/sdr2.c -libavformat/sdsdec.c -libavformat/sdxdec.c -libavformat/seek.c -libavformat/segafilm.c -libavformat/segafilmenc.c -libavformat/segment.c -libavformat/serdec.c -libavformat/sga.c -libavformat/shortendec.c -libavformat/sierravmd.c -libavformat/siff.c -libavformat/smacker.c -libavformat/smjpeg.c -libavformat/smjpeg.h -libavformat/smjpegdec.c -libavformat/smjpegenc.c -libavformat/smoothstreamingenc.c -libavformat/smush.c -libavformat/sol.c -libavformat/sox.h -libavformat/soxdec.c -libavformat/soxenc.c -libavformat/spdif.c -libavformat/spdif.h -libavformat/spdifdec.c -libavformat/spdifenc.c -libavformat/srtdec.c -libavformat/srtenc.c -libavformat/srtp.c -libavformat/srtp.h -libavformat/srtpproto.c -libavformat/stldec.c -libavformat/subfile.c -libavformat/subtitles.c -libavformat/subtitles.h -libavformat/subviewer1dec.c -libavformat/subviewerdec.c -libavformat/supdec.c -libavformat/supenc.c -libavformat/svag.c -libavformat/svs.c -libavformat/swf.c -libavformat/swf.h -libavformat/swfdec.c -libavformat/swfenc.c -libavformat/takdec.c -libavformat/tcp.c -libavformat/tedcaptionsdec.c -libavformat/tee.c -libavformat/tee_common.c -libavformat/tee_common.h -libavformat/teeproto.c -libavformat/thp.c -libavformat/tiertexseq.c -libavformat/tls.c -libavformat/tls.h -libavformat/tls_gnutls.c -libavformat/tmv.c -libavformat/to_upper4.c -libavformat/tta.c -libavformat/ttaenc.c -libavformat/ttmlenc.c -libavformat/ttmlenc.h -libavformat/tty.c -libavformat/txd.c -libavformat/ty.c -libavformat/udp.c -libavformat/uncodedframecrcenc.c -libavformat/unix.c -libavformat/url.c -libavformat/url.h -libavformat/urldecode.c -libavformat/urldecode.h -libavformat/usmdec.c -libavformat/utils.c -libavformat/vag.c -libavformat/vapoursynth.c -libavformat/vc1dec.c -libavformat/vc1test.c -libavformat/vc1testenc.c -libavformat/version.c -libavformat/version.h -libavformat/version_major.h -libavformat/vividas.c -libavformat/vivo.c -libavformat/voc.c -libavformat/voc.h -libavformat/voc_packet.c -libavformat/vocdec.c -libavformat/vocenc.c -libavformat/vorbiscomment.c -libavformat/vorbiscomment.h -libavformat/vpcc.c -libavformat/vpcc.h -libavformat/vpk.c -libavformat/vplayerdec.c -libavformat/vqf.c -libavformat/vvc.c -libavformat/vvc.h -libavformat/vvcdec.c -libavformat/w64.c -libavformat/w64.h -libavformat/wady.c -libavformat/wavarc.c -libavformat/wavdec.c -libavformat/wavenc.c -libavformat/wc3movie.c -libavformat/webm_chunk.c -libavformat/webmdashenc.c -libavformat/webpenc.c -libavformat/webvttdec.c -libavformat/webvttenc.c -libavformat/westwood_aud.c -libavformat/westwood_audenc.c -libavformat/westwood_vqa.c -libavformat/wsddec.c -libavformat/wtv.h -libavformat/wtv_common.c -libavformat/wtvdec.c -libavformat/wtvenc.c -libavformat/wv.c -libavformat/wv.h -libavformat/wvdec.c -libavformat/wvedec.c -libavformat/wvenc.c -libavformat/xa.c -libavformat/xmd.c -libavformat/xmv.c -libavformat/xvag.c -libavformat/xwma.c -libavformat/yop.c -libavformat/yuv4mpeg.h -libavformat/yuv4mpegdec.c -libavformat/yuv4mpegenc.c -libavutil/Makefile -libavutil/aarch64/Makefile -libavutil/aarch64/asm.S -libavutil/aarch64/cpu.c -libavutil/aarch64/cpu.h -libavutil/aarch64/float_dsp_init.c -libavutil/aarch64/float_dsp_neon.S -libavutil/aarch64/intreadwrite.h -libavutil/aarch64/neontest.h -libavutil/aarch64/timer.h -libavutil/aarch64/tx_float_init.c -libavutil/aarch64/tx_float_neon.S -libavutil/adler32.c -libavutil/adler32.h -libavutil/aes.c -libavutil/aes.h -libavutil/aes_ctr.c -libavutil/aes_ctr.h -libavutil/aes_internal.h -libavutil/ambient_viewing_environment.c -libavutil/ambient_viewing_environment.h -libavutil/arm/Makefile -libavutil/arm/asm.S -libavutil/arm/bswap.h -libavutil/arm/cpu.c -libavutil/arm/cpu.h -libavutil/arm/float_dsp_arm.h -libavutil/arm/float_dsp_init_arm.c -libavutil/arm/float_dsp_init_neon.c -libavutil/arm/float_dsp_init_vfp.c -libavutil/arm/float_dsp_neon.S -libavutil/arm/float_dsp_vfp.S -libavutil/arm/intmath.h -libavutil/arm/neontest.h -libavutil/arm/timer.h -libavutil/attributes.h -libavutil/attributes_internal.h -libavutil/audio_fifo.c -libavutil/audio_fifo.h -libavutil/avassert.h -libavutil/avsscanf.c -libavutil/avstring.c -libavutil/avstring.h -libavutil/avutil.h -libavutil/base64.c -libavutil/base64.h -libavutil/blowfish.c -libavutil/blowfish.h -libavutil/bprint.c -libavutil/bprint.h -libavutil/bswap.h -libavutil/buffer.c -libavutil/buffer.h -libavutil/buffer_internal.h -libavutil/camellia.c -libavutil/camellia.h -libavutil/cast5.c -libavutil/cast5.h -libavutil/channel_layout.c -libavutil/channel_layout.h -libavutil/colorspace.h -libavutil/common.h -libavutil/cpu.c -libavutil/cpu.h -libavutil/cpu_internal.h -libavutil/crc.c -libavutil/crc.h -libavutil/csp.c -libavutil/csp.h -libavutil/cuda_check.h -libavutil/des.c -libavutil/des.h -libavutil/detection_bbox.c -libavutil/detection_bbox.h -libavutil/dict.c -libavutil/dict.h -libavutil/dict_internal.h -libavutil/display.c -libavutil/display.h -libavutil/dovi_meta.c -libavutil/dovi_meta.h -libavutil/downmix_info.c -libavutil/downmix_info.h -libavutil/dynarray.h -libavutil/emms.h -libavutil/encryption_info.c -libavutil/encryption_info.h -libavutil/error.c -libavutil/error.h -libavutil/eval.c -libavutil/eval.h -libavutil/executor.c -libavutil/executor.h -libavutil/ffmath.h -libavutil/fifo.c -libavutil/fifo.h -libavutil/file.c -libavutil/file.h -libavutil/file_open.c -libavutil/file_open.h -libavutil/film_grain_params.c -libavutil/film_grain_params.h -libavutil/fixed_dsp.c -libavutil/fixed_dsp.h -libavutil/float2half.c -libavutil/float2half.h -libavutil/float_dsp.c -libavutil/float_dsp.h -libavutil/frame.c -libavutil/frame.h -libavutil/getenv_utf8.h -libavutil/half2float.c -libavutil/half2float.h -libavutil/hash.c -libavutil/hash.h -libavutil/hdr_dynamic_metadata.c -libavutil/hdr_dynamic_metadata.h -libavutil/hdr_dynamic_vivid_metadata.c -libavutil/hdr_dynamic_vivid_metadata.h -libavutil/hmac.c -libavutil/hmac.h -libavutil/hwcontext.c -libavutil/hwcontext.h -libavutil/hwcontext_cuda.c -libavutil/hwcontext_cuda.h -libavutil/hwcontext_cuda_internal.h -libavutil/hwcontext_d3d11va.h -libavutil/hwcontext_d3d12va.c -libavutil/hwcontext_d3d12va.h -libavutil/hwcontext_d3d12va_internal.h -libavutil/hwcontext_drm.c -libavutil/hwcontext_drm.h -libavutil/hwcontext_dxva2.h -libavutil/hwcontext_internal.h -libavutil/hwcontext_mediacodec.h -libavutil/hwcontext_opencl.c -libavutil/hwcontext_opencl.h -libavutil/hwcontext_qsv.c -libavutil/hwcontext_qsv.h -libavutil/hwcontext_stub.c -libavutil/hwcontext_vaapi.c -libavutil/hwcontext_vaapi.h -libavutil/hwcontext_vdpau.c -libavutil/hwcontext_vdpau.h -libavutil/hwcontext_videotoolbox.h -libavutil/hwcontext_vulkan.c -libavutil/hwcontext_vulkan.h -libavutil/iamf.c -libavutil/iamf.h -libavutil/imgutils.c -libavutil/imgutils.h -libavutil/imgutils_internal.h -libavutil/integer.c -libavutil/integer.h -libavutil/internal.h -libavutil/intfloat.h -libavutil/intmath.c -libavutil/intmath.h -libavutil/intreadwrite.h -libavutil/lfg.c -libavutil/lfg.h -libavutil/libavutil.v -libavutil/libm.h -libavutil/lls.c -libavutil/lls.h -libavutil/log.c -libavutil/log.h -libavutil/log2_tab.c -libavutil/loongarch/Makefile -libavutil/loongarch/cpu.c -libavutil/loongarch/cpu.h -libavutil/lzo.c -libavutil/lzo.h -libavutil/macos_kperf.h -libavutil/macros.h -libavutil/mastering_display_metadata.c -libavutil/mastering_display_metadata.h -libavutil/mathematics.c -libavutil/mathematics.h -libavutil/md5.c -libavutil/md5.h -libavutil/mem.c -libavutil/mem.h -libavutil/mem_internal.h -libavutil/mips/Makefile -libavutil/motion_vector.h -libavutil/murmur3.c -libavutil/murmur3.h -libavutil/objc.h -libavutil/opt.c -libavutil/opt.h -libavutil/parseutils.c -libavutil/parseutils.h -libavutil/pca.h -libavutil/pixdesc.c -libavutil/pixdesc.h -libavutil/pixelutils.c -libavutil/pixelutils.h -libavutil/pixfmt.h -libavutil/ppc/Makefile -libavutil/ppc/cpu.c -libavutil/ppc/cpu.h -libavutil/ppc/float_dsp_altivec.c -libavutil/ppc/float_dsp_altivec.h -libavutil/ppc/float_dsp_init.c -libavutil/ppc/float_dsp_vsx.c -libavutil/ppc/float_dsp_vsx.h -libavutil/ppc/intreadwrite.h -libavutil/ppc/timer.h -libavutil/ppc/util_altivec.h -libavutil/qsort.h -libavutil/random_seed.c -libavutil/random_seed.h -libavutil/rational.c -libavutil/rational.h -libavutil/rc4.c -libavutil/rc4.h -libavutil/replaygain.h -libavutil/reverse.c -libavutil/reverse.h -libavutil/ripemd.c -libavutil/ripemd.h -libavutil/riscv/Makefile -libavutil/riscv/asm.S -libavutil/riscv/bswap.h -libavutil/riscv/bswap_rvb.S -libavutil/riscv/cpu.c -libavutil/riscv/cpu.h -libavutil/riscv/cpu_common.c -libavutil/riscv/fixed_dsp_init.c -libavutil/riscv/fixed_dsp_rvv.S -libavutil/riscv/float_dsp_init.c -libavutil/riscv/float_dsp_rvv.S -libavutil/riscv/intmath.h -libavutil/riscv/lls_init.c -libavutil/riscv/lls_rvv.S -libavutil/samplefmt.c -libavutil/samplefmt.h -libavutil/sfc64.h -libavutil/sha.c -libavutil/sha.h -libavutil/sha512.c -libavutil/sha512.h -libavutil/slicethread.c -libavutil/slicethread.h -libavutil/softfloat.h -libavutil/softfloat_ieee754.h -libavutil/softfloat_tables.h -libavutil/spherical.c -libavutil/spherical.h -libavutil/stereo3d.c -libavutil/stereo3d.h -libavutil/tablegen.h -libavutil/tea.c -libavutil/tea.h -libavutil/tests/side_data_array.c -libavutil/thread.h -libavutil/threadmessage.c -libavutil/threadmessage.h -libavutil/time.c -libavutil/time.h -libavutil/time_internal.h -libavutil/timecode.c -libavutil/timecode.h -libavutil/timer.h -libavutil/timestamp.c -libavutil/timestamp.h -libavutil/tree.c -libavutil/tree.h -libavutil/twofish.c -libavutil/twofish.h -libavutil/tx.c -libavutil/tx.h -libavutil/tx_double.c -libavutil/tx_float.c -libavutil/tx_int32.c -libavutil/tx_priv.h -libavutil/tx_template.c -libavutil/utils.c -libavutil/uuid.c -libavutil/uuid.h -libavutil/version.c -libavutil/version.h -libavutil/version_major.h -libavutil/video_enc_params.c -libavutil/video_enc_params.h -libavutil/video_hint.c -libavutil/video_hint.h -libavutil/vulkan.c -libavutil/vulkan.h -libavutil/vulkan_functions.h -libavutil/vulkan_loader.h -libavutil/wchar_filename.h -libavutil/x86/Makefile -libavutil/x86/asm.h -libavutil/x86/bswap.h -libavutil/x86/cpu.c -libavutil/x86/cpu.h -libavutil/x86/cpuid.asm -libavutil/x86/emms.asm -libavutil/x86/fixed_dsp.asm -libavutil/x86/fixed_dsp_init.c -libavutil/x86/float_dsp.asm -libavutil/x86/float_dsp_init.c -libavutil/x86/imgutils.asm -libavutil/x86/imgutils_init.c -libavutil/x86/intmath.h -libavutil/x86/intreadwrite.h -libavutil/x86/lls.asm -libavutil/x86/lls_init.c -libavutil/x86/pixelutils.asm -libavutil/x86/pixelutils.h -libavutil/x86/pixelutils_init.c -libavutil/x86/timer.h -libavutil/x86/tx_float.asm -libavutil/x86/tx_float_init.c -libavutil/x86/w64xmmtest.h -libavutil/x86/x86inc.asm -libavutil/x86/x86util.asm -libavutil/xga_font_data.c -libavutil/xga_font_data.h -libavutil/xtea.c -libavutil/xtea.h -libpostproc/Makefile -libpostproc/libpostproc.v -libpostproc/postprocess.c -libpostproc/postprocess.h -libpostproc/postprocess_altivec_template.c -libpostproc/postprocess_internal.h -libpostproc/postprocess_template.c -libpostproc/version.c -libpostproc/version.h -libpostproc/version_major.h -libswresample/Makefile -libswresample/aarch64/Makefile -libswresample/aarch64/audio_convert_init.c -libswresample/aarch64/audio_convert_neon.S -libswresample/aarch64/neontest.c -libswresample/aarch64/resample.S -libswresample/aarch64/resample_init.c -libswresample/arm/Makefile -libswresample/arm/audio_convert_init.c -libswresample/arm/audio_convert_neon.S -libswresample/arm/neontest.c -libswresample/arm/resample.S -libswresample/arm/resample_init.c -libswresample/audioconvert.c -libswresample/audioconvert.h -libswresample/dither.c -libswresample/dither_template.c -libswresample/libswresample.v -libswresample/log2_tab.c -libswresample/noise_shaping_data.c -libswresample/options.c -libswresample/rematrix.c -libswresample/rematrix_template.c -libswresample/resample.c -libswresample/resample.h -libswresample/resample_dsp.c -libswresample/resample_template.c -libswresample/soxr_resample.c -libswresample/swresample.c -libswresample/swresample.h -libswresample/swresample_frame.c -libswresample/swresample_internal.h -libswresample/version.c -libswresample/version.h -libswresample/version_major.h -libswresample/x86/Makefile -libswresample/x86/audio_convert.asm -libswresample/x86/audio_convert_init.c -libswresample/x86/rematrix.asm -libswresample/x86/rematrix_init.c -libswresample/x86/resample.asm -libswresample/x86/resample_init.c -libswresample/x86/w64xmmtest.c -libswscale/Makefile -libswscale/aarch64/Makefile -libswscale/aarch64/hscale.S -libswscale/aarch64/input.S -libswscale/aarch64/output.S -libswscale/aarch64/range_convert_neon.S -libswscale/aarch64/rgb2rgb.c -libswscale/aarch64/rgb2rgb_neon.S -libswscale/aarch64/swscale.c -libswscale/aarch64/swscale_unscaled.c -libswscale/aarch64/swscale_unscaled_neon.S -libswscale/aarch64/yuv2rgb_neon.S -libswscale/alphablend.c -libswscale/arm/Makefile -libswscale/arm/hscale.S -libswscale/arm/output.S -libswscale/arm/rgb2yuv_neon_16.S -libswscale/arm/rgb2yuv_neon_32.S -libswscale/arm/rgb2yuv_neon_common.S -libswscale/arm/swscale.c -libswscale/arm/swscale_unscaled.c -libswscale/arm/yuv2rgb_neon.S -libswscale/bayer_template.c -libswscale/gamma.c -libswscale/half2float.c -libswscale/hscale.c -libswscale/hscale_fast_bilinear.c -libswscale/input.c -libswscale/libswscale.v -libswscale/log2_tab.c -libswscale/options.c -libswscale/output.c -libswscale/ppc/Makefile -libswscale/ppc/swscale_altivec.c -libswscale/ppc/swscale_ppc_template.c -libswscale/ppc/swscale_vsx.c -libswscale/ppc/yuv2rgb_altivec.c -libswscale/ppc/yuv2rgb_altivec.h -libswscale/ppc/yuv2yuv_altivec.c -libswscale/rgb2rgb.c -libswscale/rgb2rgb.h -libswscale/rgb2rgb_template.c -libswscale/riscv/Makefile -libswscale/riscv/cpu_common.c -libswscale/riscv/input_rvv.S -libswscale/riscv/range_rvv.S -libswscale/riscv/rgb2rgb.c -libswscale/riscv/rgb2rgb_rvb.S -libswscale/riscv/rgb2rgb_rvv.S -libswscale/riscv/swscale.c -libswscale/slice.c -libswscale/swscale.c -libswscale/swscale.h -libswscale/swscale_internal.h -libswscale/swscale_unscaled.c -libswscale/utils.c -libswscale/version.c -libswscale/version.h -libswscale/version_major.h -libswscale/vscale.c -libswscale/x86/Makefile -libswscale/x86/hscale_fast_bilinear_simd.c -libswscale/x86/input.asm -libswscale/x86/output.asm -libswscale/x86/range_convert.asm -libswscale/x86/rgb2rgb.c -libswscale/x86/rgb_2_rgb.asm -libswscale/x86/scale.asm -libswscale/x86/scale_avx2.asm -libswscale/x86/swscale.c -libswscale/x86/swscale_template.c -libswscale/x86/w64xmmtest.c -libswscale/x86/yuv2rgb.c -libswscale/x86/yuv2yuvX.asm -libswscale/x86/yuv_2_rgb.asm -libswscale/yuv2rgb.c -presets/libvpx-1080p.ffpreset -presets/libvpx-1080p50_60.ffpreset -presets/libvpx-360p.ffpreset -presets/libvpx-720p.ffpreset -presets/libvpx-720p50_60.ffpreset -tests/Makefile -tests/api/Makefile -tests/checkasm/Makefile -tests/checkasm/aacencdsp.c -tests/checkasm/aacpsdsp.c -tests/checkasm/aarch64/checkasm.S -tests/checkasm/ac3dsp.c -tests/checkasm/af_afir.c -tests/checkasm/alacdsp.c -tests/checkasm/arm/checkasm.S -tests/checkasm/audiodsp.c -tests/checkasm/av_tx.c -tests/checkasm/blockdsp.c -tests/checkasm/bswapdsp.c -tests/checkasm/checkasm.c -tests/checkasm/checkasm.h -tests/checkasm/exrdsp.c -tests/checkasm/fixed_dsp.c -tests/checkasm/flacdsp.c -tests/checkasm/float_dsp.c -tests/checkasm/fmtconvert.c -tests/checkasm/g722dsp.c -tests/checkasm/huffyuvdsp.c -tests/checkasm/idctdsp.c -tests/checkasm/jpeg2000dsp.c -tests/checkasm/llauddsp.c -tests/checkasm/llviddsp.c -tests/checkasm/llviddspenc.c -tests/checkasm/lpc.c -tests/checkasm/motion.c -tests/checkasm/opusdsp.c -tests/checkasm/pixblockdsp.c -tests/checkasm/riscv/checkasm.S -tests/checkasm/sbrdsp.c -tests/checkasm/svq1enc.c -tests/checkasm/sw_gbrp.c -tests/checkasm/sw_rgb.c -tests/checkasm/sw_scale.c -tests/checkasm/synth_filter.c -tests/checkasm/takdsp.c -tests/checkasm/utvideodsp.c -tests/checkasm/v210dec.c -tests/checkasm/v210enc.c -tests/checkasm/vf_blend.c -tests/checkasm/vf_colorspace.c -tests/checkasm/vf_convolution.c -tests/checkasm/vf_eq.c -tests/checkasm/vf_gblur.c -tests/checkasm/vf_hflip.c -tests/checkasm/vf_nlmeans.c -tests/checkasm/vf_threshold.c -tests/checkasm/videodsp.c -tests/checkasm/vorbisdsp.c -tests/checkasm/vp8dsp.c -tests/checkasm/vp9dsp.c -tests/checkasm/vvc_mc.c -tests/checkasm/x86/checkasm.asm -tests/fate/aac.mak -tests/fate/ac3.mak -tests/fate/acodec.mak -tests/fate/adpcm.mak -tests/fate/alac.mak -tests/fate/als.mak -tests/fate/amrnb.mak -tests/fate/amrwb.mak -tests/fate/api.mak -tests/fate/apng.mak -tests/fate/atrac.mak -tests/fate/audio.mak -tests/fate/bmp.mak -tests/fate/build.mak -tests/fate/caf.mak -tests/fate/canopus.mak -tests/fate/cbs.mak -tests/fate/cdxl.mak -tests/fate/checkasm.mak -tests/fate/concatdec.mak -tests/fate/cover-art.mak -tests/fate/dca.mak -tests/fate/demux.mak -tests/fate/dfa.mak -tests/fate/dnxhd.mak -tests/fate/dpcm.mak -tests/fate/dvvideo.mak -tests/fate/ea.mak -tests/fate/enc_external.mak -tests/fate/exif.mak -tests/fate/ffmpeg.mak -tests/fate/ffprobe.mak -tests/fate/fifo-muxer.mak -tests/fate/filter-audio.mak -tests/fate/filter-video.mak -tests/fate/fits.mak -tests/fate/flac.mak -tests/fate/flvenc.mak -tests/fate/gapless.mak -tests/fate/gif.mak -tests/fate/h264.mak -tests/fate/hap.mak -tests/fate/hevc.mak -tests/fate/hlsenc.mak -tests/fate/hw.mak -tests/fate/iamf.mak -tests/fate/id3v2.mak -tests/fate/image.mak -tests/fate/imf.mak -tests/fate/indeo.mak -tests/fate/jpeg2000.mak -tests/fate/jxl.mak -tests/fate/lavf-audio.mak -tests/fate/lavf-container.mak -tests/fate/lavf-image.mak -tests/fate/lavf-image2pipe.mak -tests/fate/lavf-video.mak -tests/fate/libavcodec.mak -tests/fate/libavdevice.mak -tests/fate/libavformat.mak -tests/fate/libavutil.mak -tests/fate/libswresample.mak -tests/fate/libswscale.mak -tests/fate/lossless-audio.mak -tests/fate/lossless-video.mak -tests/fate/matroska.mak -tests/fate/microsoft.mak -tests/fate/monkeysaudio.mak -tests/fate/mov.mak -tests/fate/mp3.mak -tests/fate/mpc.mak -tests/fate/mpeg4.mak -tests/fate/mpegps.mak -tests/fate/mpegts.mak -tests/fate/mxf.mak -tests/fate/oma.mak -tests/fate/opus.mak -tests/fate/pcm.mak -tests/fate/pixfmt.mak -tests/fate/pixlet.mak -tests/fate/probe.mak -tests/fate/prores.mak -tests/fate/qoa.mak -tests/fate/qt.mak -tests/fate/qtrle.mak -tests/fate/real.mak -tests/fate/screen.mak -tests/fate/seek.mak -tests/fate/segafilm.mak -tests/fate/segment.mak -tests/fate/source-check.sh -tests/fate/source.mak -tests/fate/spdif.mak -tests/fate/speedhq.mak -tests/fate/subtitles.mak -tests/fate/truehd.mak -tests/fate/utvideo.mak -tests/fate/vbn.mak -tests/fate/vcodec.mak -tests/fate/video.mak -tests/fate/voice.mak -tests/fate/vorbis.mak -tests/fate/vpx.mak -tests/fate/vqf.mak -tests/fate/vvc.mak -tests/fate/wavpack.mak -tests/fate/webm-dash-manifest.mak -tests/fate/wma.mak -tests/fate/xvid.mak -tests/maps/fsync-down -tests/maps/fsync-up -tests/streamgroups/audio_element-5_1_4 -tests/streamgroups/audio_element-7_1_4 -tests/streamgroups/audio_element-ambisonic_1 -tests/streamgroups/audio_element-stereo -tests/streamgroups/mix_presentation-5_1_4 -tests/streamgroups/mix_presentation-7_1_4 -tests/streamgroups/mix_presentation-ambisonic_1 -tests/streamgroups/mix_presentation-stereo -tools/Makefile -tools/aviocat.c -tools/crypto_bench.c -tools/cws2fws.c -tools/decode_simple.c -tools/decode_simple.h -tools/enc_recon_frame_test.c -tools/enum_options.c -tools/ffescape.c -tools/ffeval.c -tools/ffhash.c -tools/fourcc2pixfmt.c -tools/graph2dot.c -tools/ismindex.c -tools/pktdumper.c -tools/probetest.c -tools/qt-faststart.c -tools/scale_slice_test.c -tools/seek_print.c -tools/sidxindex.c -tools/sofa2wavs.c -tools/source2c -tools/target_sws_fuzzer.c -tools/trasher.c -tools/uncoded_frame.c -tools/venc_data_dump.c -tools/zmqsend.c diff --git a/ffmpeg_gen_free_tarball.sh b/ffmpeg_gen_free_tarball.sh deleted file mode 100755 index f4710fe..0000000 --- a/ffmpeg_gen_free_tarball.sh +++ /dev/null @@ -1,130 +0,0 @@ -#!/bin/bash -# -# Copyright (c) 2022 Andreas Schneider -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . -# -# shellcheck disable=2181 - -export LC_COLLATE="C.UTF-8" - -FF_PKGNAME="ffmpeg" -FF_PKGNAME_SUFFIX="-free" -FF_VERSION="$(rpmspec -P ./*.spec | grep ^Version | sed -e 's/Version:[ ]*//g')" -FF_TARBALL_URL="https://ffmpeg.org/releases/${FF_PKGNAME}-${FF_VERSION}.tar.xz" -FF_TARBALL="$(basename "${FF_TARBALL_URL}")" -FF_GPG_ARMOR_FILE="${FF_TARBALL}.asc" -FF_PKG_DIR="$(pwd)" -FF_KEYRING="${FF_PKG_DIR}/ffmpeg.keyring" -FF_TMPDIR=$(mktemp --tmpdir -d ffmpeg-XXXXXXXX) -FF_PATH="${FF_TMPDIR}/${FF_PKGNAME}-${FF_VERSION}" - -cleanup_tmpdir() { - # shellcheck disable=2164 - popd 2>/dev/null - rm -rf "${FF_TMPDIR}" -} -trap cleanup_tmpdir SIGINT - -cleanup_and_exit() -{ - cleanup_tmpdir - - if test "$1" = 0 -o -z "$1"; then - exit 0 - else - # shellcheck disable=2086 - exit ${1} - fi -} - -if [[ ! -w "${FF_TARBALL}" ]]; then - echo ">>> Downloading tarball" - wget "${FF_TARBALL_URL}" -fi -if [[ ! -w "${FF_TARBALL}.asc" ]]; then - echo ">>> Downloading signature" - wget "${FF_TARBALL_URL}.asc" -fi - -echo ">>> Verifying ${FF_TARBALL} GPG signature" -gpgv2 --quiet --keyring "${FF_KEYRING}" "${FF_GPG_ARMOR_FILE}" "${FF_TARBALL}" -if [ $? -ne 0 ]; then - echo "ERROR: GPG signature verification failed" - cleanup_and_exit 1 -fi -echo - -echo ">>> Unpacking ${FF_TARBALL}" - -tar -xf "${FF_TARBALL}" -C "${FF_TMPDIR}" -if [ $? -ne 0 ]; then - echo "ERROR: Failed to unpack ${FF_TARBALL}" - cleanup_and_exit 1 -fi - -if [[ ! -r ffmpeg_free_sources ]]; then - echo "ERROR: ffmpeg_free_sources doesn't exist!" - cleanup_and_exit 1 -fi -readarray -t keepfiles < ffmpeg_free_sources - -pushd "${FF_PATH}" || cleanup_and_exit 1 - -echo -echo ">>> Cleaning up sources for new tarball ..." - -# Get file list from ffmpeg -mapfile -d '' filelist < <(find ./ -type f -printf '%P\0') - -# Sort arrays -readarray -t keepfiles_sorted < <(printf '%s\0' "${keepfiles[@]}" | sort -z | xargs -0n1) -readarray -t filelist_sorted < <(printf '%s\0' "${filelist[@]}" | sort -z | xargs -0n1) - -# Compare arrays and remove files which are left over -comm -2 -3 -z <(printf '%s\0' "${filelist_sorted[@]}") <(printf '%s\0' "${keepfiles_sorted[@]}") | xargs -0 rm -f - -readarray -t removed_files < <(comm -1 -3 -z <(printf '%s\0' "${filelist_sorted[@]}") <(printf '%s\0' "${keepfiles_sorted[@]}") | xargs -0n1) -if [[ "${#removed_files[@]}" -ge 1 ]]; then - if [[ "${#removed_files[@]}" -eq 1 ]] && [[ -z "${removed_files[0]}" ]]; then - echo "... done" - else - echo "File not in upstream tarball anymore (please cleanup 'ffmpeg_free_sources'):" - for f in "${removed_files[@]}"; do - if [[ -z "${f}" ]]; then - continue - fi - echo " * ${f}" - done - fi -fi -echo - -popd || cleanup_and_exit 1 # /FF_PATH - -pushd "${FF_TMPDIR}" || cleanup_and_exit 1 - -echo ">>> Create new tarball ${FF_PKGNAME}${FF_PKGNAME_SUFFIX}-${FF_VERSION}.tar.xz ..." -tar -cJf "${FF_PKG_DIR}/${FF_PKGNAME}${FF_PKGNAME_SUFFIX}-${FF_VERSION}.tar.xz" "${FF_PKGNAME}-${FF_VERSION}" -if [ $? -ne 0 ]; then - echo "ERROR: Creating tarball failed" - cleanup_and_exit 1 -fi - -popd || cleanup_and_exit 1 # /FF_TMPDIR - -du -sh "${FF_PKGNAME}${FF_PKGNAME_SUFFIX}-${FF_VERSION}.tar.xz" -echo - -cleanup_and_exit 0 diff --git a/ffmpeg_update_free_sources.sh b/ffmpeg_update_free_sources.sh deleted file mode 100755 index 7dc5c9c..0000000 --- a/ffmpeg_update_free_sources.sh +++ /dev/null @@ -1,60 +0,0 @@ -#!/bin/bash -# -# Copyright (c) 2022 Andreas Schneider -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . -# -# shellcheck disable=2181 - -export LC_COLLATE="C.UTF-8" - -cleanup_and_exit() -{ - if test "$1" = 0 -o -z "$1"; then - exit 0 - else - # shellcheck disable=2086 - exit ${1} - fi -} - -echo ">>> Collect information from ${1}" -build_log="$(readlink -f "${1}")" -if [[ -z "${build_log}" ]] || [[ ! -r "${build_log}" ]]; then - echo "Build log doesn't exist: %{build_log}" - cleanup_and_exit 1 -fi - -asm_files="$(grep "^gcc.*\.c$" "${build_log}" | awk 'NF>1{print $NF}' | sort)" -c_files="$(grep "^nasm.*\.asm$" "${build_log}" | awk 'NF>1{print $NF}' | sort)" - -# shellcheck disable=2206 -new_sources=(${asm_files} - ${c_files}) - -# Sort arrays -readarray -t new_sources_sorted < <(printf '%s\0' "${new_sources[@]}" | sort -z | xargs -0n1) - -# Create a backup for a diff -cp -a ffmpeg_free_sources ffmpeg_free_sources.orig -cp -a ffmpeg_free_sources ffmpeg_free_sources.new -printf "%s\n" "${new_sources_sorted[@]}" >> ffmpeg_free_sources.new -# Update ffmpeg_free_sources -echo ">>> Updating ffmpeg_free_sources" -sort < ffmpeg_free_sources.new | uniq | sed '/^$/d' > ffmpeg_free_sources -echo ">>> Differences in file list" -diff -u ffmpeg_free_sources.orig ffmpeg_free_sources -rm -f ffmpeg_free_sources.new - -cleanup_and_exit 0 diff --git a/sources b/sources index ed3bf3b..418c9f0 100644 --- a/sources +++ b/sources @@ -1,3 +1,3 @@ -SHA512 (ffmpeg-free-7.1.1.tar.xz) = 997e867dd07ac1d228ce20b5c60e6d1a2c3d155b7af381fd0c80b594ccf6f002c7e660f775185be41cf94c8753e74633f99999f6327388f3feb2d8d5aa19dd88 +SHA512 (ffmpeg-7.1.1.tar.xz) = 42486e485c8fc6f3ec61598a1a7cb40360535762b3fcf28c10d7c6840bc55afe3334434912746e69eef862d3cedf45a02953bde73d38547d2d9a7a38a65e123a SHA512 (ffmpeg-7.1.1.tar.xz.asc) = 480846fd939d00f2ea90c0256081519a6996c7a990d0f66444a7ae1bce2e5ad6380f5d751efc9bde18da9c4d34738ade57dd66288b989dfd074c484562e20e75 SHA512 (ffmpeg.keyring) = 9b36506835db36f776b7ddb53ad6fa9e915e6ca2f9c7cfebe8eb45513e1036a985283590a840ca313a111bf35dc3731f68885aaafb1fb7011ec433cc119e5165 From b7a44a001532e8847022c29f7f00fa616961f421 Mon Sep 17 00:00:00 2001 From: Neal Gompa Date: Fri, 13 Jun 2025 05:09:46 -0400 Subject: [PATCH 75/95] Enable aic decoder --- enable_decoders | 1 + 1 file changed, 1 insertion(+) diff --git a/enable_decoders b/enable_decoders index 4743afd..d41f4e7 100644 --- a/enable_decoders +++ b/enable_decoders @@ -57,6 +57,7 @@ adpcm_xa adpcm_xmd adpcm_yamaha adpcm_zork +aic alac alias_pix amrnb From 60df3956c6cd651b644e39cb310d3253c393f29b Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Wed, 23 Jul 2025 20:29:42 +0000 Subject: [PATCH 76/95] Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild --- ffmpeg.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ffmpeg.spec b/ffmpeg.spec index 4e59df4..bed9118 100644 --- a/ffmpeg.spec +++ b/ffmpeg.spec @@ -85,7 +85,7 @@ Name: ffmpeg %global pkg_name %{name}%{?pkg_suffix} Version: 7.1.1 -Release: 4%{?dist} +Release: 5%{?dist} Summary: A complete solution to record, convert and stream audio and video License: GPL-3.0-or-later URL: https://ffmpeg.org/ @@ -858,6 +858,9 @@ rm -rf %{buildroot}%{_datadir}/%{name}/examples %{_mandir}/man3/libswscale.3* %changelog +* Wed Jul 23 2025 Fedora Release Engineering - 7.1.1-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild + * Fri Jun 13 2025 Neal Gompa - 7.1.1-4 - Switch to regular upstream sources for package build - Enable more codecs From 9e25239d79749214dbf91088a4d5416c1a7f6ede Mon Sep 17 00:00:00 2001 From: Nicolas Chauvet Date: Tue, 29 Jul 2025 12:36:02 +0200 Subject: [PATCH 77/95] Rebuilt for libplacebo --- ffmpeg.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ffmpeg.spec b/ffmpeg.spec index bed9118..5c05b43 100644 --- a/ffmpeg.spec +++ b/ffmpeg.spec @@ -85,7 +85,7 @@ Name: ffmpeg %global pkg_name %{name}%{?pkg_suffix} Version: 7.1.1 -Release: 5%{?dist} +Release: 6%{?dist} Summary: A complete solution to record, convert and stream audio and video License: GPL-3.0-or-later URL: https://ffmpeg.org/ @@ -858,6 +858,9 @@ rm -rf %{buildroot}%{_datadir}/%{name}/examples %{_mandir}/man3/libswscale.3* %changelog +* Tue Jul 29 2025 Nicolas Chauvet - 7.1.1-6 +- Rebuilt for libplacebo + * Wed Jul 23 2025 Fedora Release Engineering - 7.1.1-5 - Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild From 3c0fb7f11f0fa171f6b2edca086c2c255fc98825 Mon Sep 17 00:00:00 2001 From: Neal Gompa Date: Fri, 1 Aug 2025 14:02:36 -0400 Subject: [PATCH 78/95] Always verify sources --- ffmpeg.spec | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ffmpeg.spec b/ffmpeg.spec index 5c05b43..c75c2b7 100644 --- a/ffmpeg.spec +++ b/ffmpeg.spec @@ -1,5 +1,4 @@ # For a complete build enable these two -%bcond upstream_tarball 0 %bcond all_codecs 0 # Break dependency cycles by disabling certain optional dependencies. @@ -85,7 +84,7 @@ Name: ffmpeg %global pkg_name %{name}%{?pkg_suffix} Version: 7.1.1 -Release: 6%{?dist} +Release: 7%{?dist} Summary: A complete solution to record, convert and stream audio and video License: GPL-3.0-or-later URL: https://ffmpeg.org/ @@ -530,9 +529,7 @@ pixel format conversion operations. This subpackage contains the headers for FFmpeg libswscale. %prep -%if %{with upstream_tarball} %{gpgverify} --keyring='%{SOURCE2}' --signature='%{SOURCE1}' --data='%{SOURCE0}' -%endif %autosetup -S git_am install -m 0644 %{SOURCE20} enable_decoders @@ -858,6 +855,9 @@ rm -rf %{buildroot}%{_datadir}/%{name}/examples %{_mandir}/man3/libswscale.3* %changelog +* Fri Aug 01 2025 Neal Gompa - 7.1.1-7 +- Always verify sources + * Tue Jul 29 2025 Nicolas Chauvet - 7.1.1-6 - Rebuilt for libplacebo From fab40474b5d24e80fbd8de58e2af24478001c708 Mon Sep 17 00:00:00 2001 From: Neal Gompa Date: Fri, 1 Aug 2025 14:05:58 -0400 Subject: [PATCH 79/95] Fix bcond comments --- ffmpeg.spec | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ffmpeg.spec b/ffmpeg.spec index c75c2b7..636f34e 100644 --- a/ffmpeg.spec +++ b/ffmpeg.spec @@ -1,11 +1,11 @@ -# For a complete build enable these two +# For a complete build enable this %bcond all_codecs 0 # Break dependency cycles by disabling certain optional dependencies. %bcond bootstrap 0 -# If you want to do a build with the upstream source tarball, then set the -# pkg_suffix to %%nil. We can't handle this with a conditional, as srpm +# If building with all codecs, then set the pkg_suffix to %%nil. +# We can't handle this with a conditional, as srpm # generation would not take it into account. %global pkg_suffix -free From 0b12983802af68a24509e9c7479c21bfb2881254 Mon Sep 17 00:00:00 2001 From: Neal Gompa Date: Wed, 20 Aug 2025 20:40:56 -0400 Subject: [PATCH 80/95] Reorganize spec to group subpackage definitions together - Add freeworld conditional for third-party builds - Drop unneeded scriptlets --- ffmpeg.spec | 285 +++++++++++++++++++++++++++++++++------------------- 1 file changed, 184 insertions(+), 101 deletions(-) diff --git a/ffmpeg.spec b/ffmpeg.spec index 636f34e..7ac845b 100644 --- a/ffmpeg.spec +++ b/ffmpeg.spec @@ -9,6 +9,17 @@ # generation would not take it into account. %global pkg_suffix -free +# For alternative builds (do not enable in Fedora!) +%bcond freeworld 0 + +%if %{with freeworld} +# Freeworld builds enable all codecs +%global with_all_codecs 1 +# Freeworld builds do not need a package suffix +%global pkg_suffix %{nil} +%global basepkg_suffix -free +%endif + # Fails due to asm issue %ifarch %{ix86} %{arm} %bcond lto 0 @@ -84,7 +95,7 @@ Name: ffmpeg %global pkg_name %{name}%{?pkg_suffix} Version: 7.1.1 -Release: 7%{?dist} +Release: 8%{?dist} Summary: A complete solution to record, convert and stream audio and video License: GPL-3.0-or-later URL: https://ffmpeg.org/ @@ -271,6 +282,8 @@ community or a corporation. This build of ffmpeg is limited in the number of codecs supported. %endif +%dnl -------------------------------------------------------------------------------- + %if "x%{?pkg_suffix}" != "x" %package -n %{pkg_name} Summary: A complete solution to record, convert and stream audio and video @@ -298,6 +311,18 @@ This build of ffmpeg is limited in the number of codecs supported. #/ "x%%{?pkg_suffix}" != "x" %endif +%files -n %{pkg_name} +%doc CREDITS README.md +%{_bindir}/ffmpeg +%{_bindir}/ffplay +%{_bindir}/ffprobe +%{_mandir}/man1/ff*.1* +%dir %{_datadir}/%{name} +%{_datadir}/%{name}/ffprobe.xsd +%{_datadir}/%{name}/libvpx-*.ffpreset + +%dnl -------------------------------------------------------------------------------- + %package -n %{pkg_name}-devel Summary: Development package for %{name} Requires: libavcodec%{?pkg_suffix}-devel = %{version}-%{release} @@ -317,6 +342,12 @@ machines have created. It supports the most obscure ancient formats up to the cutting edge. No matter if they were designed by some standards committee, the community or a corporation. +%files -n %{pkg_name}-devel +%doc MAINTAINERS doc/APIchanges doc/*.txt +%doc _doc/examples + +%dnl -------------------------------------------------------------------------------- + %package -n libavcodec%{?pkg_suffix} Summary: FFmpeg codec library Requires: libavutil%{?pkg_suffix}%{_isa} = %{version}-%{release} @@ -334,6 +365,12 @@ subtitle streams, and several bitstream filters. This build of ffmpeg is limited in the number of codecs supported. %endif +%files -n libavcodec%{?pkg_suffix} +%license COPYING.GPLv2 LICENSE.md +%{_libdir}/libavcodec.so.%{av_codec_soversion}{,.*} + +%dnl -------------------------------------------------------------------------------- + %package -n libavcodec%{?pkg_suffix}-devel Summary: Development files for FFmpeg's codec library Requires: libavutil%{?pkg_suffix}-devel = %{version}-%{release} @@ -347,6 +384,43 @@ subtitle streams, and several bitstream filters. This subpackage contains the headers for FFmpeg libavcodec. +%files -n libavcodec%{?pkg_suffix}-devel +%{_includedir}/%{name}/libavcodec +%{_libdir}/pkgconfig/libavcodec.pc +%{_libdir}/libavcodec.so +%{_mandir}/man3/libavcodec.3* + +%dnl -------------------------------------------------------------------------------- + +%if %{with freeworld} +%package -n libavcodec-freeworld +Summary: FFmpeg codec library - freeworld overlay +Requires: libavutil%{?basepkg_suffix}%{_isa} >= %{version}-%{release} +Requires: libswresample%{?basepkg_suffix}%{_isa} >= %{version}-%{release} +Supplements: libavcodec%{?basepkg_suffix}%{_isa} >= %{version}-%{release} +# We require libopenh264 library, which has a dummy implementation and a real one +# In the event that this is being installed, we want to install this version +Requires: openh264%{_isa} + +%description -n libavcodec-freeworld +The libavcodec library provides a generic encoding/decoding framework +and contains multiple decoders and encoders for audio, video and +subtitle streams, and several bitstream filters. + +This build includes the full range of codecs offered by ffmpeg. + +%files -n libavcodec-freeworld +%{_sysconfdir}/ld.so.conf.d/%{name}-%{_lib}.conf +%{_libdir}/%{name}/libavcodec.so.%{av_codec_soversion}{,.*} + +# Re-enable ldconfig_scriptlets macros +%{!?ldconfig:%global ldconfig /sbin/ldconfig} +%ldconfig_scriptlets -n libavcodec-freeworld + +%endif + +%dnl -------------------------------------------------------------------------------- + %package -n libavdevice%{?pkg_suffix} Summary: FFmpeg device library Requires: libavcodec%{?pkg_suffix}%{_isa} = %{version}-%{release} @@ -360,6 +434,12 @@ and rendering to many common multimedia input/output devices, and supports several input and output devices, including Video4Linux2, VfW, DShow, and ALSA. +%files -n libavdevice%{?pkg_suffix} +%license COPYING.GPLv2 LICENSE.md +%{_libdir}/libavdevice.so.%{av_device_soversion}{,.*} + +%dnl -------------------------------------------------------------------------------- + %package -n libavdevice%{?pkg_suffix}-devel Summary: Development files for FFmpeg's device library Requires: libavcodec%{?pkg_suffix}-devel = %{version}-%{release} @@ -380,6 +460,14 @@ DShow, and ALSA. This subpackage contains the headers for FFmpeg libavdevice. +%files -n libavdevice%{?pkg_suffix}-devel +%{_includedir}/%{name}/libavdevice +%{_libdir}/pkgconfig/libavdevice.pc +%{_libdir}/libavdevice.so +%{_mandir}/man3/libavdevice.3* + +%dnl -------------------------------------------------------------------------------- + %package -n libavfilter%{?pkg_suffix} Summary: FFmpeg audio and video filtering library Requires: libavcodec%{?pkg_suffix}%{_isa} = %{version}-%{release} @@ -393,6 +481,12 @@ Requires: libswscale%{?pkg_suffix}%{_isa} = %{version}-%{release} The libavfilter library provides a generic audio/video filtering framework containing several filters, sources and sinks. +%files -n libavfilter%{?pkg_suffix} +%license COPYING.GPLv2 LICENSE.md +%{_libdir}/libavfilter.so.%{av_filter_soversion}{,.*} + +%dnl -------------------------------------------------------------------------------- + %package -n libavfilter%{?pkg_suffix}-devel Summary: Development files for FFmpeg's audio/video filter library Requires: libavcodec%{?pkg_suffix}-devel = %{version}-%{release} @@ -410,6 +504,14 @@ framework containing several filters, sources and sinks. This subpackage contains the headers for FFmpeg libavfilter. +%files -n libavfilter%{?pkg_suffix}-devel +%{_includedir}/%{name}/libavfilter +%{_libdir}/pkgconfig/libavfilter.pc +%{_libdir}/libavfilter.so +%{_mandir}/man3/libavfilter.3* + +%dnl -------------------------------------------------------------------------------- + %package -n libavformat%{?pkg_suffix} Summary: FFmpeg's stream format library Requires: libavcodec%{?pkg_suffix}%{_isa} = %{version}-%{release} @@ -425,6 +527,12 @@ container formats. This build of ffmpeg is limited in the number of codecs supported. %endif +%files -n libavformat%{?pkg_suffix} +%license COPYING.GPLv2 LICENSE.md +%{_libdir}/libavformat.so.%{av_format_soversion}{,.*} + +%dnl -------------------------------------------------------------------------------- + %package -n libavformat%{?pkg_suffix}-devel Summary: Development files for FFmpeg's stream format library Requires: libavcodec%{?pkg_suffix}-devel = %{version}-%{release} @@ -441,6 +549,14 @@ container formats. This subpackage contains the headers for FFmpeg libavformat. +%files -n libavformat%{?pkg_suffix}-devel +%{_includedir}/%{name}/libavformat +%{_libdir}/pkgconfig/libavformat.pc +%{_libdir}/libavformat.so +%{_mandir}/man3/libavformat.3* + +%dnl -------------------------------------------------------------------------------- + %package -n libavutil%{?pkg_suffix} Summary: FFmpeg's utility library Group: System/Libraries @@ -452,6 +568,12 @@ number generators, data structures, additional mathematics functions, cryptography and multimedia related functionality (like enumerations for pixel and sample formats). +%files -n libavutil%{?pkg_suffix} +%license COPYING.GPLv2 LICENSE.md +%{_libdir}/libavutil.so.%{av_util_soversion}{,.*} + +%dnl -------------------------------------------------------------------------------- + %package -n libavutil%{?pkg_suffix}-devel Summary: Development files for FFmpeg's utility library Requires: libavutil%{?pkg_suffix}%{_isa} = %{version}-%{release} @@ -466,6 +588,14 @@ for pixel and sample formats). This subpackage contains the headers for FFmpeg libavutil. +%files -n libavutil%{?pkg_suffix}-devel +%{_includedir}/%{name}/libavutil +%{_libdir}/pkgconfig/libavutil.pc +%{_libdir}/libavutil.so +%{_mandir}/man3/libavutil.3* + +%dnl -------------------------------------------------------------------------------- + %package -n libpostproc%{?pkg_suffix} Summary: FFmpeg post-processing library Requires: libavutil%{?pkg_suffix}%{_isa} = %{version}-%{release} @@ -475,6 +605,12 @@ A library with video postprocessing filters, such as deblocking and deringing filters, noise reduction, automatic contrast and brightness correction, linear/cubic interpolating deinterlacing. +%files -n libpostproc%{?pkg_suffix} +%license COPYING.GPLv2 LICENSE.md +%{_libdir}/libpostproc.so.%{postproc_soversion}{,.*} + +%dnl -------------------------------------------------------------------------------- + %package -n libpostproc%{?pkg_suffix}-devel Summary: Development files for the FFmpeg post-processing library Requires: libavutil%{?pkg_suffix}-devel = %{version}-%{release} @@ -488,6 +624,13 @@ correction, linear/cubic interpolating deinterlacing. This subpackage contains the headers for FFmpeg libpostproc. +%files -n libpostproc%{?pkg_suffix}-devel +%{_includedir}/%{name}/libpostproc +%{_libdir}/pkgconfig/libpostproc.pc +%{_libdir}/libpostproc.so + +%dnl -------------------------------------------------------------------------------- + %package -n libswresample%{?pkg_suffix} Summary: FFmpeg software resampling library Requires: libavutil%{?pkg_suffix}%{_isa} = %{version}-%{release} @@ -496,6 +639,12 @@ Requires: libavutil%{?pkg_suffix}%{_isa} = %{version}-%{release} The libswresample library performs audio conversion between different sample rates, channel layout and channel formats. +%files -n libswresample%{?pkg_suffix} +%license COPYING.GPLv2 LICENSE.md +%{_libdir}/libswresample.so.%{swresample_soversion}{,.*} + +%dnl -------------------------------------------------------------------------------- + %package -n libswresample%{?pkg_suffix}-devel Summary: Development files for the FFmpeg software resampling library Requires: libavutil%{?pkg_suffix}-devel = %{version}-%{release} @@ -507,6 +656,14 @@ sample rates, channel layout and channel formats. This subpackage contains the headers for FFmpeg libswresample. +%files -n libswresample%{?pkg_suffix}-devel +%{_includedir}/%{name}/libswresample +%{_libdir}/pkgconfig/libswresample.pc +%{_libdir}/libswresample.so +%{_mandir}/man3/libswresample.3* + +%dnl -------------------------------------------------------------------------------- + %package -n libswscale%{?pkg_suffix} Summary: FFmpeg image scaling and colorspace/pixel conversion library Requires: libavutil%{?pkg_suffix}%{_isa} = %{version}-%{release} @@ -515,6 +672,12 @@ Requires: libavutil%{?pkg_suffix}%{_isa} = %{version}-%{release} The libswscale library performs image scaling and colorspace and pixel format conversion operations. +%files -n libswscale%{?pkg_suffix} +%license COPYING.GPLv2 LICENSE.md +%{_libdir}/libswscale.so.%{swscale_soversion}{,.*} + +%dnl -------------------------------------------------------------------------------- + %package -n libswscale%{?pkg_suffix}-devel Summary: Development files for FFmpeg's image scaling and colorspace library Provides: libswscale%{?pkg_suffix}-devel = %{version}-%{release} @@ -528,6 +691,14 @@ pixel format conversion operations. This subpackage contains the headers for FFmpeg libswscale. +%files -n libswscale%{?pkg_suffix}-devel +%{_includedir}/%{name}/libswscale +%{_libdir}/pkgconfig/libswscale.pc +%{_libdir}/libswscale.so +%{_mandir}/man3/libswscale.3* + +%dnl -------------------------------------------------------------------------------- + %prep %{gpgverify} --keyring='%{SOURCE2}' --signature='%{SOURCE1}' --data='%{SOURCE0}' @@ -752,109 +923,21 @@ done # We will package is as %%doc in the devel package rm -rf %{buildroot}%{_datadir}/%{name}/examples -%ldconfig_scriptlets -n libavcodec%{?pkg_suffix} -%ldconfig_scriptlets -n libavdevice%{?pkg_suffix} -%ldconfig_scriptlets -n libavfilter%{?pkg_suffix} -%ldconfig_scriptlets -n libavformat%{?pkg_suffix} -%ldconfig_scriptlets -n libavutil%{?pkg_suffix} -%ldconfig_scriptlets -n libpostproc%{?pkg_suffix} -%ldconfig_scriptlets -n libswresample%{?pkg_suffix} -%ldconfig_scriptlets -n libswscle%{?pkg_suffix} +%if %{with freeworld} +# Install the libavcodec freeworld counterpart +mkdir -p %{buildroot}%{_sysconfdir}/ld.so.conf.d/ +mkdir -p %{buildroot}%{_libdir}/%{name} +echo -e "%{_libdir}/%{name}\n" > %{buildroot}%{_sysconfdir}/ld.so.conf.d/%{name}-%{_lib}.conf +cp -pa %{buildroot}%{_libdir}/libavcodec.so.%{av_codec_soversion}{,.*} %{buildroot}%{_libdir}/%{name} +%endif -%files -n %{pkg_name} -%doc CREDITS README.md -%{_bindir}/ffmpeg -%{_bindir}/ffplay -%{_bindir}/ffprobe -%{_mandir}/man1/ff*.1* -%dir %{_datadir}/%{name} -%{_datadir}/%{name}/ffprobe.xsd -%{_datadir}/%{name}/libvpx-*.ffpreset - -%files -n %{pkg_name}-devel -%doc MAINTAINERS doc/APIchanges doc/*.txt -%doc _doc/examples - -%files -n libavcodec%{?pkg_suffix} -%license COPYING.GPLv2 LICENSE.md -%{_libdir}/libavcodec.so.%{av_codec_soversion}{,.*} - -%files -n libavcodec%{?pkg_suffix}-devel -%{_includedir}/%{name}/libavcodec -%{_libdir}/pkgconfig/libavcodec.pc -%{_libdir}/libavcodec.so -%{_mandir}/man3/libavcodec.3* - -%files -n libavdevice%{?pkg_suffix} -%license COPYING.GPLv2 LICENSE.md -%{_libdir}/libavdevice.so.%{av_device_soversion}{,.*} - -%files -n libavdevice%{?pkg_suffix}-devel -%{_includedir}/%{name}/libavdevice -%{_libdir}/pkgconfig/libavdevice.pc -%{_libdir}/libavdevice.so -%{_mandir}/man3/libavdevice.3* - -%files -n libavfilter%{?pkg_suffix} -%license COPYING.GPLv2 LICENSE.md -%{_libdir}/libavfilter.so.%{av_filter_soversion}{,.*} - -%files -n libavfilter%{?pkg_suffix}-devel -%{_includedir}/%{name}/libavfilter -%{_libdir}/pkgconfig/libavfilter.pc -%{_libdir}/libavfilter.so -%{_mandir}/man3/libavfilter.3* - -%files -n libavformat%{?pkg_suffix} -%license COPYING.GPLv2 LICENSE.md -%{_libdir}/libavformat.so.%{av_format_soversion}{,.*} - -%files -n libavformat%{?pkg_suffix}-devel -%{_includedir}/%{name}/libavformat -%{_libdir}/pkgconfig/libavformat.pc -%{_libdir}/libavformat.so -%{_mandir}/man3/libavformat.3* - -%files -n libavutil%{?pkg_suffix} -%license COPYING.GPLv2 LICENSE.md -%{_libdir}/libavutil.so.%{av_util_soversion}{,.*} - -%files -n libavutil%{?pkg_suffix}-devel -%{_includedir}/%{name}/libavutil -%{_libdir}/pkgconfig/libavutil.pc -%{_libdir}/libavutil.so -%{_mandir}/man3/libavutil.3* - -%files -n libpostproc%{?pkg_suffix} -%license COPYING.GPLv2 LICENSE.md -%{_libdir}/libpostproc.so.%{postproc_soversion}{,.*} - -%files -n libpostproc%{?pkg_suffix}-devel -%{_includedir}/%{name}/libpostproc -%{_libdir}/pkgconfig/libpostproc.pc -%{_libdir}/libpostproc.so - -%files -n libswresample%{?pkg_suffix} -%license COPYING.GPLv2 LICENSE.md -%{_libdir}/libswresample.so.%{swresample_soversion}{,.*} - -%files -n libswresample%{?pkg_suffix}-devel -%{_includedir}/%{name}/libswresample -%{_libdir}/pkgconfig/libswresample.pc -%{_libdir}/libswresample.so -%{_mandir}/man3/libswresample.3* - -%files -n libswscale%{?pkg_suffix} -%license COPYING.GPLv2 LICENSE.md -%{_libdir}/libswscale.so.%{swscale_soversion}{,.*} - -%files -n libswscale%{?pkg_suffix}-devel -%{_includedir}/%{name}/libswscale -%{_libdir}/pkgconfig/libswscale.pc -%{_libdir}/libswscale.so -%{_mandir}/man3/libswscale.3* %changelog +* Thu Aug 21 2025 Neal Gompa - 7.1.1-8 +- Reorganize spec to group subpackage definitions together +- Add freeworld conditional for third-party builds +- Drop unneeded scriptlets + * Fri Aug 01 2025 Neal Gompa - 7.1.1-7 - Always verify sources From 7396d13cc722db5fc1a08bb802ba4515491d5161 Mon Sep 17 00:00:00 2001 From: Neal Gompa Date: Mon, 25 Aug 2025 09:32:19 -0400 Subject: [PATCH 81/95] Enable support for MPEG-5/EVC --- enable_decoders | 1 + enable_encoders | 1 + ffmpeg-support-evc-base-libraries.patch | 73 +++++++++++++++++++++++++ ffmpeg.spec | 28 +++++++--- 4 files changed, 95 insertions(+), 8 deletions(-) create mode 100644 ffmpeg-support-evc-base-libraries.patch diff --git a/enable_decoders b/enable_decoders index d41f4e7..068cb34 100644 --- a/enable_decoders +++ b/enable_decoders @@ -219,6 +219,7 @@ libspeex # speex libvorbis # libvorbis libvpx_vp8 # libvpx libvpx_vp9 # libvpx +libxevd libzvbi_teletext # zvbi loco lscr diff --git a/enable_encoders b/enable_encoders index 17b8be3..6dbed60 100644 --- a/enable_encoders +++ b/enable_encoders @@ -96,6 +96,7 @@ libvpx_vp8 # libvpx libvpx_vp9 # libvpx libwebp # libwebp libwebp_anim # libwebp +libxeve libxvid # xvidcore mjpeg # mjpegtools mjpeg_qsv # mjpegtools diff --git a/ffmpeg-support-evc-base-libraries.patch b/ffmpeg-support-evc-base-libraries.patch new file mode 100644 index 0000000..add444f --- /dev/null +++ b/ffmpeg-support-evc-base-libraries.patch @@ -0,0 +1,73 @@ +From 80bf83e3099652a3e7f8d1e8b6d902fea1ce4db9 Mon Sep 17 00:00:00 2001 +From: James Almer +Date: Sun, 24 Aug 2025 15:57:16 -0300 +Subject: [PATCH] configure: support linking to base profile libxev{d,e} + +Addresses issue #20328. + +Signed-off-by: James Almer +--- + configure | 16 ++++++++++++++-- + 1 file changed, 14 insertions(+), 2 deletions(-) + +diff --git a/configure b/configure +index aa41b2a7b3..5386ae8b9a 100755 +--- a/configure ++++ b/configure +@@ -299,7 +299,9 @@ External library support: + --enable-libx264 enable H.264 encoding via x264 [no] + --enable-libx265 enable HEVC encoding via x265 [no] + --enable-libxeve enable EVC encoding via libxeve [no] ++ --enable-libxeveb enable EVC encoding via libxeve (Base profile) [no] + --enable-libxevd enable EVC decoding via libxevd [no] ++ --enable-libxevdb enable EVC decoding via libxevd (Base profile) [no] + --enable-libxavs enable AVS encoding via xavs [no] + --enable-libxavs2 enable AVS2 encoding via xavs2 [no] + --enable-libxcb enable X11 grabbing using XCB [autodetect] +@@ -1992,7 +1994,9 @@ EXTERNAL_LIBRARY_LIST=" + libvvenc + libwebp + libxevd ++ libxevdb + libxeve ++ libxeveb + libxml2 + libzimg + libzmq +@@ -3669,8 +3673,8 @@ libx265_encoder_deps="libx265" + libx265_encoder_select="atsc_a53 dovi_rpuenc" + libxavs_encoder_deps="libxavs" + libxavs2_encoder_deps="libxavs2" +-libxevd_decoder_deps="libxevd" +-libxeve_encoder_deps="libxeve" ++libxevd_decoder_deps_any="libxevd libxevdb" ++libxeve_encoder_deps_any="libxeve libxeveb" + libxvid_encoder_deps="libxvid" + libzvbi_teletext_decoder_deps="libzvbi" + vapoursynth_demuxer_deps="vapoursynth" +@@ -4615,6 +4619,12 @@ enabled_all gnutls mbedtls && + enabled_all openssl mbedtls && + die "OpenSSL and mbedTLS must not be enabled at the same time." + ++enabled_all libxevd libxevdb && ++ die "libxevd and libxevdb must not be enabled at the same time." ++ ++enabled_all libxeve libxeveb && ++ die "libxeve and libxevdb must not be enabled at the same time." ++ + # Disable all the library-specific components if the library itself + # is disabled, see AVCODEC_LIST and following _LIST variables. + +@@ -7204,7 +7214,9 @@ enabled libx265 && require_pkg_config libx265 x265 x265.h x265_api_get + enabled libxavs && require libxavs "stdint.h xavs.h" xavs_encoder_encode "-lxavs $pthreads_extralibs $libm_extralibs" + enabled libxavs2 && require_pkg_config libxavs2 "xavs2 >= 1.3.0" "stdint.h xavs2.h" xavs2_api_get + enabled libxevd && require_pkg_config libxevd "xevd >= 0.4.1" "xevd.h" xevd_decode ++enabled libxevdb && require_pkg_config libxevdb "xevdb >= 0.4.1" "xevd.h" xevd_decode + enabled libxeve && require_pkg_config libxeve "xeve >= 0.5.1" "xeve.h" xeve_encode ++enabled libxeveb && require_pkg_config libxeveb "xeveb >= 0.5.1" "xeve.h" xeve_encode + enabled libxvid && require libxvid xvid.h xvid_global -lxvidcore + enabled libzimg && require_pkg_config libzimg "zimg >= 2.7.0" zimg.h zimg_get_api_version + enabled libzmq && require_pkg_config libzmq "libzmq >= 4.2.1" zmq.h zmq_ctx_new +-- +2.49.1 + diff --git a/ffmpeg.spec b/ffmpeg.spec index 7ac845b..7cc74cd 100644 --- a/ffmpeg.spec +++ b/ffmpeg.spec @@ -61,14 +61,15 @@ %bcond placebo 1 %endif +# For using an alternative build of EVC codecs +%bcond evc_main 0 + %if %{with all_codecs} -%bcond evc 1 %bcond rtmp 1 %bcond vvc 1 %bcond x264 1 %bcond x265 1 %else -%bcond evc 0 %bcond rtmp 0 %bcond vvc 0 %bcond x264 0 @@ -95,7 +96,7 @@ Name: ffmpeg %global pkg_name %{name}%{?pkg_suffix} Version: 7.1.1 -Release: 8%{?dist} +Release: 9%{?dist} Summary: A complete solution to record, convert and stream audio and video License: GPL-3.0-or-later URL: https://ffmpeg.org/ @@ -112,6 +113,8 @@ Patch1: ffmpeg-codec-choice.patch # Allow to build with fdk-aac-free # See https://bugzilla.redhat.com/show_bug.cgi?id=1501522#c112 Patch2: ffmpeg-allow-fdk-aac-free.patch +# Support building with EVC base profile libraries +Patch3: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20329.patch#/ffmpeg-support-evc-base-libraries.patch # Backport fix for CVE-2025-22921 Patch10: https://git.ffmpeg.org/gitweb/ffmpeg.git/patch/7f9c7f9849a2155224711f0ff57ecdac6e4bfb57#/ffmpeg-CVE-2025-22921.patch @@ -256,9 +259,12 @@ BuildRequires: librtmp-devel %if %{with vpl} BuildRequires: pkgconfig(vpl) >= 2.6 %endif -%if %{with evc} -BuildRequires: pkgconfig(libxevd) -BuildRequires: pkgconfig(libxeve) +%if %{with evc_main} +BuildRequires: pkgconfig(xevd) +BuildRequires: pkgconfig(xeve) +%else +BuildRequires: pkgconfig(xevdb) +BuildRequires: pkgconfig(xeveb) %endif %if %{with x264} BuildRequires: pkgconfig(x264) @@ -832,9 +838,12 @@ cp -a doc/examples/{*.c,Makefile,README} _doc/examples/ --enable-libopencore-amrnb \ --enable-libopencore-amrwb \ --enable-libvo-amrwbenc \ -%if %{with evc} +%if %{with evc_main} --enable-libxeve \ --enable-libxevd \ +%else + --enable-libxeveb \ + --enable-libxevdb \ %endif %if %{with x264} --enable-libx264 \ @@ -857,7 +866,7 @@ cp -a doc/examples/{*.c,Makefile,README} _doc/examples/ --enable-hwaccels \ --disable-encoders \ --disable-decoders \ - --disable-decoder="h264,hevc,libxevd,vc1,vvc" \ + --disable-decoder="h264,hevc,vc1,vvc" \ --enable-encoder="$(perl -pe 's{^(\w*).*}{$1,}gs' - 7.1.1-9 +- Enable support for MPEG-5/EVC + * Thu Aug 21 2025 Neal Gompa - 7.1.1-8 - Reorganize spec to group subpackage definitions together - Add freeworld conditional for third-party builds From 0ba015fad89d41da8c16275b1e715dd6f61d61f9 Mon Sep 17 00:00:00 2001 From: Neal Gompa Date: Tue, 26 Aug 2025 14:28:33 -0400 Subject: [PATCH 82/95] Disable all subpackages except libavcodec-freeworld with the freeworld bcond --- ffmpeg.spec | 80 +++++++++++++++++++++++++++++++---------------------- 1 file changed, 47 insertions(+), 33 deletions(-) diff --git a/ffmpeg.spec b/ffmpeg.spec index 7cc74cd..097be72 100644 --- a/ffmpeg.spec +++ b/ffmpeg.spec @@ -10,9 +10,9 @@ %global pkg_suffix -free # For alternative builds (do not enable in Fedora!) -%bcond freeworld 0 +%bcond freeworld_lavc 0 -%if %{with freeworld} +%if %{with freeworld_lavc} # Freeworld builds enable all codecs %global with_all_codecs 1 # Freeworld builds do not need a package suffix @@ -96,7 +96,7 @@ Name: ffmpeg %global pkg_name %{name}%{?pkg_suffix} Version: 7.1.1 -Release: 9%{?dist} +Release: 10%{?dist} Summary: A complete solution to record, convert and stream audio and video License: GPL-3.0-or-later URL: https://ffmpeg.org/ @@ -290,6 +290,8 @@ This build of ffmpeg is limited in the number of codecs supported. %dnl -------------------------------------------------------------------------------- +%if ! %{with freeworld_lavc} + %if "x%{?pkg_suffix}" != "x" %package -n %{pkg_name} Summary: A complete solution to record, convert and stream audio and video @@ -398,35 +400,6 @@ This subpackage contains the headers for FFmpeg libavcodec. %dnl -------------------------------------------------------------------------------- -%if %{with freeworld} -%package -n libavcodec-freeworld -Summary: FFmpeg codec library - freeworld overlay -Requires: libavutil%{?basepkg_suffix}%{_isa} >= %{version}-%{release} -Requires: libswresample%{?basepkg_suffix}%{_isa} >= %{version}-%{release} -Supplements: libavcodec%{?basepkg_suffix}%{_isa} >= %{version}-%{release} -# We require libopenh264 library, which has a dummy implementation and a real one -# In the event that this is being installed, we want to install this version -Requires: openh264%{_isa} - -%description -n libavcodec-freeworld -The libavcodec library provides a generic encoding/decoding framework -and contains multiple decoders and encoders for audio, video and -subtitle streams, and several bitstream filters. - -This build includes the full range of codecs offered by ffmpeg. - -%files -n libavcodec-freeworld -%{_sysconfdir}/ld.so.conf.d/%{name}-%{_lib}.conf -%{_libdir}/%{name}/libavcodec.so.%{av_codec_soversion}{,.*} - -# Re-enable ldconfig_scriptlets macros -%{!?ldconfig:%global ldconfig /sbin/ldconfig} -%ldconfig_scriptlets -n libavcodec-freeworld - -%endif - -%dnl -------------------------------------------------------------------------------- - %package -n libavdevice%{?pkg_suffix} Summary: FFmpeg device library Requires: libavcodec%{?pkg_suffix}%{_isa} = %{version}-%{release} @@ -703,6 +676,38 @@ This subpackage contains the headers for FFmpeg libswscale. %{_libdir}/libswscale.so %{_mandir}/man3/libswscale.3* +%endif +# freeworld_lavc bcond + +%dnl -------------------------------------------------------------------------------- + +%if %{with freeworld_lavc} +%package -n libavcodec-freeworld +Summary: FFmpeg codec library - freeworld overlay +Requires: libavutil%{?basepkg_suffix}%{_isa} >= %{version}-%{release} +Requires: libswresample%{?basepkg_suffix}%{_isa} >= %{version}-%{release} +Supplements: libavcodec%{?basepkg_suffix}%{_isa} >= %{version}-%{release} +# We require libopenh264 library, which has a dummy implementation and a real one +# In the event that this is being installed, we want to install this version +Requires: openh264%{_isa} + +%description -n libavcodec-freeworld +The libavcodec library provides a generic encoding/decoding framework +and contains multiple decoders and encoders for audio, video and +subtitle streams, and several bitstream filters. + +This build includes the full range of codecs offered by ffmpeg. + +%files -n libavcodec-freeworld +%{_sysconfdir}/ld.so.conf.d/%{name}-%{_lib}.conf +%{_libdir}/%{name}/libavcodec.so.%{av_codec_soversion}{,.*} + +# Re-enable ldconfig_scriptlets macros +%{!?ldconfig:%global ldconfig /sbin/ldconfig} +%ldconfig_scriptlets -n libavcodec-freeworld + +%endif + %dnl -------------------------------------------------------------------------------- %prep @@ -932,16 +937,25 @@ done # We will package is as %%doc in the devel package rm -rf %{buildroot}%{_datadir}/%{name}/examples -%if %{with freeworld} +%if %{with freeworld_lavc} # Install the libavcodec freeworld counterpart mkdir -p %{buildroot}%{_sysconfdir}/ld.so.conf.d/ mkdir -p %{buildroot}%{_libdir}/%{name} echo -e "%{_libdir}/%{name}\n" > %{buildroot}%{_sysconfdir}/ld.so.conf.d/%{name}-%{_lib}.conf cp -pa %{buildroot}%{_libdir}/libavcodec.so.%{av_codec_soversion}{,.*} %{buildroot}%{_libdir}/%{name} +# Drop unneeded stuff +rm -f %{buildroot}%{_libdir}/*.* +rm -rf %{buildroot}%{_libdir}/pkgconfig +rm -rf %{buildroot}%{_includedir} +rm -rf %{buildroot}%{_bindir} +rm -rf %{buildroot}%{_datadir} %endif %changelog +* Tue Aug 26 2025 Neal Gompa - 7.1.1-10 +- Disable all subpackages except libavcodec-freeworld with the freeworld bcond + * Mon Aug 25 2025 Neal Gompa - 7.1.1-9 - Enable support for MPEG-5/EVC From 5917b714a19abefcfa2cfbec15b28b33e4b41a04 Mon Sep 17 00:00:00 2001 From: Simone Caronni Date: Wed, 24 Sep 2025 18:05:39 +0200 Subject: [PATCH 83/95] Update to 7.1.2, adjust options --- ffmpeg.spec | 131 ++++++++++++++++++++++++++++++++++++---------------- sources | 4 +- 2 files changed, 92 insertions(+), 43 deletions(-) diff --git a/ffmpeg.spec b/ffmpeg.spec index 097be72..d17e2d3 100644 --- a/ffmpeg.spec +++ b/ffmpeg.spec @@ -37,8 +37,10 @@ %ifarch s390 s390x %bcond dc1394 0 +%bcond ffnvcodec 0 %else %bcond dc1394 1 +%bcond ffnvcodec 1 %endif %if 0%{?rhel} @@ -95,8 +97,8 @@ Name: ffmpeg %global pkg_name %{name}%{?pkg_suffix} -Version: 7.1.1 -Release: 10%{?dist} +Version: 7.1.2 +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/ @@ -147,6 +149,7 @@ BuildRequires: gsm-devel BuildRequires: ladspa-devel BuildRequires: lame-devel BuildRequires: libgcrypt-devel +BuildRequires: libklvanc-devel BuildRequires: libmysofa-devel BuildRequires: libX11-devel BuildRequires: libXext-devel @@ -737,30 +740,39 @@ cp -a doc/examples/{*.c,Makefile,README} _doc/examples/ --optflags="%{build_cflags}" \ --extra-ldflags="%{build_ldflags}" \ --disable-htmlpages \ - --enable-pic \ - --disable-stripping \ - --enable-shared \ --disable-static \ + --disable-stripping \ + --enable-pic \ + --enable-shared \ --enable-gpl \ --enable-version3 \ - --enable-libsmbclient \ - --disable-openssl \ + --enable-amf \ + --enable-avcodec \ + --enable-avdevice \ + --enable-avfilter \ + --enable-avformat \ + --enable-alsa \ --enable-bzlib \ - --enable-frei0r \ %if %{with chromaprint} --enable-chromaprint \ %else --disable-chromaprint \ %endif + --disable-cuda-nvcc \ +%if %{with ffnvcodec} + --enable-cuvid \ +%endif + --disable-decklink \ + --enable-frei0r \ --enable-gcrypt \ + --enable-gmp \ --enable-gnutls \ + --enable-gray \ + --enable-iconv \ --enable-ladspa \ %if %{with lcms2} --enable-lcms2 \ %endif - --enable-libshaderc \ - --enable-vulkan \ - --disable-cuda-sdk \ --enable-libaom \ --enable-libaribb24 \ --enable-libaribcaption \ @@ -771,6 +783,7 @@ cp -a doc/examples/{*.c,Makefile,README} _doc/examples/ --enable-libcdio \ --enable-libcodec2 \ --enable-libdav1d \ + --disable-libdavs2 \ %if %{with dc1394} --enable-libdc1394 \ %endif @@ -783,8 +796,8 @@ cp -a doc/examples/{*.c,Makefile,README} _doc/examples/ --enable-libfontconfig \ --enable-libfreetype \ --enable-libfribidi \ - --enable-libharfbuzz \ --enable-libgme \ + --enable-libharfbuzz \ --enable-libgsm \ %if %{with dc1394} --enable-libiec61883 \ @@ -792,10 +805,17 @@ cp -a doc/examples/{*.c,Makefile,README} _doc/examples/ --enable-libilbc \ --enable-libjack \ --enable-libjxl \ + --enable-libklvanc \ + --disable-liblensfun \ + --disable-liblcevc-dec \ --enable-liblc3 \ --enable-libmodplug \ --enable-libmp3lame \ --enable-libmysofa \ + --disable-libnpp \ + --enable-libopencore-amrnb \ + --enable-libopencore-amrwb \ + --disable-libopencv \ --enable-libopenh264 \ --enable-libopenjpeg \ --enable-libopenmpt \ @@ -805,44 +825,54 @@ cp -a doc/examples/{*.c,Makefile,README} _doc/examples/ %endif --enable-libpulse \ --enable-libqrencode \ + --disable-libquirc \ --enable-librabbitmq \ --enable-librav1e \ --enable-librist \ --enable-librsvg \ +%if %{with librtmp} + --enable-librtmp \ +%endif --enable-librubberband \ + --enable-libshaderc \ + --disable-libshine \ + --enable-libsmbclient \ --enable-libsnappy \ --enable-libsvtav1 \ --enable-libsoxr \ --enable-libspeex \ - --enable-libssh \ --enable-libsrt \ + --enable-libssh \ + --disable-libtensorflow \ --enable-libtesseract \ --enable-libtheora \ + --disable-libtorch \ + --disable-libuavs3d \ --enable-libtwolame \ + --enable-libv4l2 \ --enable-libvidstab \ %if %{with vmaf} --enable-libvmaf \ %endif + --enable-libvo-amrwbenc \ --enable-libvorbis \ - --enable-libv4l2 \ - --enable-libvpx \ - --enable-libwebp \ - --enable-libxml2 \ - --enable-libzimg \ - --enable-libzmq \ - --enable-libzvbi \ -%if %{with lto} - --enable-lto \ -%endif %if %{with vpl} --enable-libvpl \ %endif - --enable-lv2 \ - --enable-vaapi \ - --enable-vdpau \ - --enable-libopencore-amrnb \ - --enable-libopencore-amrwb \ - --enable-libvo-amrwbenc \ + --enable-libvpx \ + --enable-libwebp \ +%if %{with x264} + --enable-libx264 \ +%endif +%if %{with x265} + --enable-libx265 \ +%endif + --disable-libxavs2 \ + --disable-libxavs \ + --enable-libxcb \ + --enable-libxcb-shape \ + --enable-libxcb-shm \ + --enable-libxcb-xfixes \ %if %{with evc_main} --enable-libxeve \ --enable-libxevd \ @@ -850,21 +880,35 @@ cp -a doc/examples/{*.c,Makefile,README} _doc/examples/ --enable-libxeveb \ --enable-libxevdb \ %endif -%if %{with x264} - --enable-libx264 \ -%endif -%if %{with x265} - --enable-libx265 \ -%endif -%if %{with librtmp} - --enable-librtmp \ -%endif + --enable-libxml2 \ --enable-libxvid \ - --enable-openal \ - --enable-opencl \ - --enable-opengl \ + --enable-libzimg \ + --enable-libzmq \ + --enable-libzvbi \ +%if %{with lto} + --enable-lto \ +%endif + --enable-lv2 \ + --enable-lzma \ + --enable-manpages \ +%if %{with ffnvcodec} + --enable-nvdec \ + --enable-nvenc \ +%endif + --disable-openssl \ + --enable-postproc \ --enable-pthreads \ + --enable-sdl2 \ + --enable-shared \ + --enable-swresample \ + --enable-swscale \ + --enable-v4l2-m2m \ + --enable-vaapi \ --enable-vapoursynth \ + --enable-vdpau \ + --enable-vulkan \ + --enable-xlib \ + --enable-zlib \ %if %{without all_codecs} --enable-muxers \ --enable-demuxers \ @@ -953,6 +997,11 @@ rm -rf %{buildroot}%{_datadir} %changelog +* Wed Sep 24 2025 Simone Caronni - 7.1.2-1 +- Update to 7.1.2. +- Enable VANC processing for SDI. +- Explicitly list all implicitly enabled/disabled options. + * Tue Aug 26 2025 Neal Gompa - 7.1.1-10 - Disable all subpackages except libavcodec-freeworld with the freeworld bcond diff --git a/sources b/sources index 418c9f0..7ed04be 100644 --- a/sources +++ b/sources @@ -1,3 +1,3 @@ -SHA512 (ffmpeg-7.1.1.tar.xz) = 42486e485c8fc6f3ec61598a1a7cb40360535762b3fcf28c10d7c6840bc55afe3334434912746e69eef862d3cedf45a02953bde73d38547d2d9a7a38a65e123a -SHA512 (ffmpeg-7.1.1.tar.xz.asc) = 480846fd939d00f2ea90c0256081519a6996c7a990d0f66444a7ae1bce2e5ad6380f5d751efc9bde18da9c4d34738ade57dd66288b989dfd074c484562e20e75 +SHA512 (ffmpeg-7.1.2.tar.xz) = 181e6415da359e3addbc448ff09b5cebe57d9c37106e5125c41f484adebc250502fc9efe150cb117d7378e20830715035be94c2ba4ad7c369b18af85f1a4ca20 +SHA512 (ffmpeg-7.1.2.tar.xz.asc) = b0358cea13be070a0d41b42e98c5df17ab8794b86a5f8b2a4bf0043e608a21b02fdbaad2bc3318457a9c43ef0d3c823509234ffd7292e6ea49b1eff951663f58 SHA512 (ffmpeg.keyring) = 9b36506835db36f776b7ddb53ad6fa9e915e6ca2f9c7cfebe8eb45513e1036a985283590a840ca313a111bf35dc3731f68885aaafb1fb7011ec433cc119e5165 From 85181b09206bdc30abe935016f44e8dad38855a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert-Andr=C3=A9=20Mauchin?= Date: Thu, 2 Oct 2025 20:12:40 +0200 Subject: [PATCH 84/95] Rebuild for svt-av1 3.1.2 From ee4847dda671126244037405d5f942be46ba11ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert-Andr=C3=A9=20Mauchin?= Date: Thu, 2 Oct 2025 20:17:02 +0200 Subject: [PATCH 85/95] Rebuild for svt-av1 3.1.2 --- ffmpeg.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ffmpeg.spec b/ffmpeg.spec index d17e2d3..1898d47 100644 --- a/ffmpeg.spec +++ b/ffmpeg.spec @@ -98,7 +98,7 @@ Name: ffmpeg %global pkg_name %{name}%{?pkg_suffix} Version: 7.1.2 -Release: 1%{?dist} +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/ @@ -997,6 +997,9 @@ rm -rf %{buildroot}%{_datadir} %changelog +* Thu Oct 02 2025 Robert-André Mauchin - 7.1.2-2 +- Rebuild for svt-av1 soname bump + * Wed Sep 24 2025 Simone Caronni - 7.1.2-1 - Update to 7.1.2. - Enable VANC processing for SDI. From 98124ea009a37b1c55514a1d371a673609914400 Mon Sep 17 00:00:00 2001 From: Simone Caronni Date: Mon, 29 Sep 2025 15:26:17 +0200 Subject: [PATCH 86/95] Exclude lc3 on RHEL --- ffmpeg.spec | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ffmpeg.spec b/ffmpeg.spec index d17e2d3..a0fac33 100644 --- a/ffmpeg.spec +++ b/ffmpeg.spec @@ -47,11 +47,13 @@ # Disable dependencies not available or wanted on RHEL/EPEL %bcond chromaprint 0 %bcond flite 0 +%bcond lc3 0 %else # Break chromaprint dependency cycle (Fedora-only): # ffmpeg (libavcodec-free) → chromaprint → ffmpeg %bcond chromaprint %{?_with_bootstrap:0}%{!?_with_bootstrap:1} %bcond flite 1 +%bcond lc3 1 %endif %if 0%{?rhel} && 0%{?rhel} <= 9 @@ -177,7 +179,9 @@ BuildRequires: pkgconfig(gnutls) BuildRequires: pkgconfig(harfbuzz) BuildRequires: pkgconfig(libilbc) BuildRequires: pkgconfig(jack) -BuildRequires: pkgconfig(lc3) +%if %{with lc3} +BuildRequires: pkgconfig(lc3) >= 1.1.0 +%endif %if %{with lcms2} BuildRequires: pkgconfig(lcms2) >= 2.13 %endif @@ -808,7 +812,9 @@ cp -a doc/examples/{*.c,Makefile,README} _doc/examples/ --enable-libklvanc \ --disable-liblensfun \ --disable-liblcevc-dec \ +%if %{with lc3} --enable-liblc3 \ +%endif --enable-libmodplug \ --enable-libmp3lame \ --enable-libmysofa \ From 7a2902320d368c722e4743a5e05ccc5db80b0bf0 Mon Sep 17 00:00:00 2001 From: Dominik 'Rathann' Mierzejewski Date: Sun, 2 Nov 2025 17:10:45 +0100 Subject: [PATCH 87/95] Re-enable OpenAL support which was disabled by accident Resolves rhbz#2404091 . Fixes: 5917b714a19abefcfa2cfbec15b28b33e4b41a04 --- ffmpeg.spec | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ffmpeg.spec b/ffmpeg.spec index adb682a..4e5eb7f 100644 --- a/ffmpeg.spec +++ b/ffmpeg.spec @@ -100,7 +100,7 @@ Name: ffmpeg %global pkg_name %{name}%{?pkg_suffix} Version: 7.1.2 -Release: 2%{?dist} +Release: 3%{?dist} Summary: A complete solution to record, convert and stream audio and video License: GPL-3.0-or-later URL: https://ffmpeg.org/ @@ -901,6 +901,7 @@ cp -a doc/examples/{*.c,Makefile,README} _doc/examples/ --enable-nvdec \ --enable-nvenc \ %endif + --enable-openal \ --disable-openssl \ --enable-postproc \ --enable-pthreads \ @@ -1003,6 +1004,9 @@ rm -rf %{buildroot}%{_datadir} %changelog +* Sun Nov 02 2025 Dominik Mierzejewski - 7.1.2-3 +- Re-enable openal support (dropped by accident in commit 5917b714, resolves rhbz#2404091) + * Thu Oct 02 2025 Robert-André Mauchin - 7.1.2-2 - Rebuild for svt-av1 soname bump From 2db297209ffa949d6e6120ea7bf8ee912ad4bade Mon Sep 17 00:00:00 2001 From: Dominik 'Rathann' Mierzejewski Date: Thu, 30 Oct 2025 15:05:49 +0100 Subject: [PATCH 88/95] fix bootstrap conditional for chromaprint Reference: https://rpm-software-management.github.io/rpm/manual/conditionalbuilds.html#check-whether-an-option-is-enabled-or-disabled --- ffmpeg.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ffmpeg.spec b/ffmpeg.spec index 4e5eb7f..e78c73d 100644 --- a/ffmpeg.spec +++ b/ffmpeg.spec @@ -51,7 +51,7 @@ %else # Break chromaprint dependency cycle (Fedora-only): # ffmpeg (libavcodec-free) → chromaprint → ffmpeg -%bcond chromaprint %{?_with_bootstrap:0}%{!?_with_bootstrap:1} +%bcond chromaprint %{?with_bootstrap:0}%{!?with_bootstrap:1} %bcond flite 1 %bcond lc3 1 %endif From 85d2ac244ec2e09f44a1dbd986e799428022ca3d Mon Sep 17 00:00:00 2001 From: Neal Gompa Date: Sun, 2 Nov 2025 12:45:07 -0500 Subject: [PATCH 89/95] Rebase to version 8.0 --- enable_decoders | 4 ++- enable_encoders | 3 +- ffmpeg-CVE-2025-22921.patch | 29 --------------- ffmpeg.spec | 71 +++++++++---------------------------- sources | 4 +-- 5 files changed, 23 insertions(+), 88 deletions(-) delete mode 100644 ffmpeg-CVE-2025-22921.patch diff --git a/enable_decoders b/enable_decoders index 068cb34..f558db4 100644 --- a/enable_decoders +++ b/enable_decoders @@ -69,6 +69,7 @@ anull apac ape apng # animated png +apv arbc argo ass # trivial @@ -210,7 +211,7 @@ libjxl # libjxl liblc3 # liblc3 libopencore_amrnb # opencore-amr libopencore_amrwb # opencore-amr -libopenh264 # openh264_dlopen +libopenh264 # openh264 libopenjpeg # openjpeg libopus # opus librsvg # librsvg @@ -335,6 +336,7 @@ pjs png # libpng ppm # trivial prores +prores_raw prosumer psd ptx diff --git a/enable_encoders b/enable_encoders index 6dbed60..ba284da 100644 --- a/enable_encoders +++ b/enable_encoders @@ -81,8 +81,9 @@ libilbc # ilbc libjxl # libjxl liblc3 # liblc3 libmp3lame # lame +liboapv libopencore_amrnb -libopenh264 # openh264_dlopen +libopenh264 # openh264 libopenjpeg # openjpeg libopus # opus librav1e # rav1e diff --git a/ffmpeg-CVE-2025-22921.patch b/ffmpeg-CVE-2025-22921.patch deleted file mode 100644 index 3a522c8..0000000 --- a/ffmpeg-CVE-2025-22921.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 7f9c7f9849a2155224711f0ff57ecdac6e4bfb57 Mon Sep 17 00:00:00 2001 -From: James Almer -Date: Wed, 1 Jan 2025 23:58:39 -0300 -Subject: [PATCH] avcodec/jpeg2000dec: clear array length when freeing it - -Fixes NULL pointer dereferences. -Fixes ticket #11393. - -Reviewed-by: Michael Niedermayer -Signed-off-by: James Almer ---- - libavcodec/jpeg2000dec.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c -index e5e897a29f..b82d85d5ee 100644 ---- a/libavcodec/jpeg2000dec.c -+++ b/libavcodec/jpeg2000dec.c -@@ -1521,6 +1521,7 @@ static int jpeg2000_decode_packet(Jpeg2000DecoderContext *s, Jpeg2000Tile *tile, - } - } - av_freep(&cblk->lengthinc); -+ cblk->nb_lengthinc = 0; - } - } - // Save state of stream --- -2.48.1 - diff --git a/ffmpeg.spec b/ffmpeg.spec index e78c73d..d3cc161 100644 --- a/ffmpeg.spec +++ b/ffmpeg.spec @@ -87,20 +87,19 @@ # FIXME: GCC says there's incompatible pointer casts going on in libavdevice... %global build_type_safety_c 2 -%global av_codec_soversion 61 -%global av_device_soversion 61 -%global av_filter_soversion 10 -%global av_format_soversion 61 -%global av_util_soversion 59 -%global postproc_soversion 58 -%global swresample_soversion 5 -%global swscale_soversion 8 +%global av_codec_soversion 62 +%global av_device_soversion 62 +%global av_filter_soversion 11 +%global av_format_soversion 62 +%global av_util_soversion 60 +%global swresample_soversion 6 +%global swscale_soversion 9 Name: ffmpeg %global pkg_name %{name}%{?pkg_suffix} -Version: 7.1.2 -Release: 3%{?dist} +Version: 8.0 +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/ @@ -120,9 +119,6 @@ Patch2: ffmpeg-allow-fdk-aac-free.patch # Support building with EVC base profile libraries Patch3: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20329.patch#/ffmpeg-support-evc-base-libraries.patch -# Backport fix for CVE-2025-22921 -Patch10: https://git.ffmpeg.org/gitweb/ffmpeg.git/patch/7f9c7f9849a2155224711f0ff57ecdac6e4bfb57#/ffmpeg-CVE-2025-22921.patch - # Add first_dts getter to libavformat for Chromium # See: https://bugzilla.redhat.com/show_bug.cgi?id=2240127 # Reference: https://crbug.com/1306560 @@ -134,7 +130,6 @@ Requires: libavdevice%{?pkg_suffix}%{_isa} = %{version}-%{release} Requires: libavfilter%{?pkg_suffix}%{_isa} = %{version}-%{release} Requires: libavformat%{?pkg_suffix}%{_isa} = %{version}-%{release} Requires: libavutil%{?pkg_suffix}%{_isa} = %{version}-%{release} -Requires: libpostproc%{?pkg_suffix}%{_isa} = %{version}-%{release} Requires: libswresample%{?pkg_suffix}%{_isa} = %{version}-%{release} Requires: libswscale%{?pkg_suffix}%{_isa} = %{version}-%{release} @@ -217,6 +212,7 @@ BuildRequires: pkgconfig(libxml-2.0) BuildRequires: pkgconfig(libzmq) BuildRequires: pkgconfig(lilv-0) BuildRequires: pkgconfig(lv2) +BuildRequires: pkgconfig(oapv) BuildRequires: pkgconfig(ogg) BuildRequires: pkgconfig(openal) BuildRequires: pkgconfig(opencore-amrnb) @@ -307,7 +303,6 @@ Requires: libavdevice%{?pkg_suffix}%{_isa} = %{version}-%{release} Requires: libavfilter%{?pkg_suffix}%{_isa} = %{version}-%{release} Requires: libavformat%{?pkg_suffix}%{_isa} = %{version}-%{release} Requires: libavutil%{?pkg_suffix}%{_isa} = %{version}-%{release} -Requires: libpostproc%{?pkg_suffix}%{_isa} = %{version}-%{release} Requires: libswresample%{?pkg_suffix}%{_isa} = %{version}-%{release} Requires: libswscale%{?pkg_suffix}%{_isa} = %{version}-%{release} @@ -345,7 +340,6 @@ Requires: libavdevice%{?pkg_suffix}-devel = %{version}-%{release} Requires: libavfilter%{?pkg_suffix}-devel = %{version}-%{release} Requires: libavformat%{?pkg_suffix}-devel = %{version}-%{release} Requires: libavutil%{?pkg_suffix}-devel = %{version}-%{release} -Requires: libpostproc%{?pkg_suffix}-devel = %{version}-%{release} Requires: libswresample%{?pkg_suffix}-devel = %{version}-%{release} Requires: libswscale%{?pkg_suffix}-devel = %{version}-%{release} Requires: pkgconfig @@ -432,7 +426,6 @@ Requires: libavcodec%{?pkg_suffix}-devel = %{version}-%{release} Requires: libavfilter%{?pkg_suffix}-devel = %{version}-%{release} Requires: libavformat%{?pkg_suffix}-devel = %{version}-%{release} Requires: libavutil%{?pkg_suffix}-devel = %{version}-%{release} -Requires: libpostproc%{?pkg_suffix}-devel = %{version}-%{release} Requires: libswresample%{?pkg_suffix}-devel = %{version}-%{release} Requires: libswscale%{?pkg_suffix}-devel = %{version}-%{release} Requires: libavdevice%{?pkg_suffix}%{_isa} = %{version}-%{release} @@ -459,7 +452,6 @@ Summary: FFmpeg audio and video filtering library Requires: libavcodec%{?pkg_suffix}%{_isa} = %{version}-%{release} Requires: libavformat%{?pkg_suffix}%{_isa} = %{version}-%{release} Requires: libavutil%{?pkg_suffix}%{_isa} = %{version}-%{release} -Requires: libpostproc%{?pkg_suffix}%{_isa} = %{version}-%{release} Requires: libswresample%{?pkg_suffix}%{_isa} = %{version}-%{release} Requires: libswscale%{?pkg_suffix}%{_isa} = %{version}-%{release} @@ -478,7 +470,6 @@ Summary: Development files for FFmpeg's audio/video filter library Requires: libavcodec%{?pkg_suffix}-devel = %{version}-%{release} Requires: libavformat%{?pkg_suffix}-devel = %{version}-%{release} Requires: libavutil%{?pkg_suffix}-devel = %{version}-%{release} -Requires: libpostproc%{?pkg_suffix}-devel = %{version}-%{release} Requires: libswresample%{?pkg_suffix}-devel = %{version}-%{release} Requires: libswscale%{?pkg_suffix}-devel = %{version}-%{release} Requires: libavfilter%{?pkg_suffix} = %{version}-%{release} @@ -546,6 +537,7 @@ This subpackage contains the headers for FFmpeg libavformat. %package -n libavutil%{?pkg_suffix} Summary: FFmpeg's utility library Group: System/Libraries +Obsoletes: libpostproc%{?pkg_suffix} < 8.0 %description -n libavutil%{?pkg_suffix} The libavutil library is a utility library to aid portable multimedia @@ -564,6 +556,7 @@ for pixel and sample formats). Summary: Development files for FFmpeg's utility library Requires: libavutil%{?pkg_suffix}%{_isa} = %{version}-%{release} Requires: pkgconfig +Obsoletes: libpostproc%{?pkg_suffix}-devel < 8.0 %description -n libavutil%{?pkg_suffix}-devel The libavutil library is a utility library to aid portable multimedia @@ -582,41 +575,6 @@ This subpackage contains the headers for FFmpeg libavutil. %dnl -------------------------------------------------------------------------------- -%package -n libpostproc%{?pkg_suffix} -Summary: FFmpeg post-processing library -Requires: libavutil%{?pkg_suffix}%{_isa} = %{version}-%{release} - -%description -n libpostproc%{?pkg_suffix} -A library with video postprocessing filters, such as deblocking and -deringing filters, noise reduction, automatic contrast and brightness -correction, linear/cubic interpolating deinterlacing. - -%files -n libpostproc%{?pkg_suffix} -%license COPYING.GPLv2 LICENSE.md -%{_libdir}/libpostproc.so.%{postproc_soversion}{,.*} - -%dnl -------------------------------------------------------------------------------- - -%package -n libpostproc%{?pkg_suffix}-devel -Summary: Development files for the FFmpeg post-processing library -Requires: libavutil%{?pkg_suffix}-devel = %{version}-%{release} -Requires: libpostproc%{?pkg_suffix}%{_isa} = %{version}-%{release} -Requires: pkgconfig - -%description -n libpostproc%{?pkg_suffix}-devel -A library with video postprocessing filters, such as deblocking and -deringing filters, noise reduction, automatic contrast and brightness -correction, linear/cubic interpolating deinterlacing. - -This subpackage contains the headers for FFmpeg libpostproc. - -%files -n libpostproc%{?pkg_suffix}-devel -%{_includedir}/%{name}/libpostproc -%{_libdir}/pkgconfig/libpostproc.pc -%{_libdir}/libpostproc.so - -%dnl -------------------------------------------------------------------------------- - %package -n libswresample%{?pkg_suffix} Summary: FFmpeg software resampling library Requires: libavutil%{?pkg_suffix}%{_isa} = %{version}-%{release} @@ -822,6 +780,7 @@ cp -a doc/examples/{*.c,Makefile,README} _doc/examples/ --enable-libopencore-amrnb \ --enable-libopencore-amrwb \ --disable-libopencv \ + --enable-liboapv \ --enable-libopenh264 \ --enable-libopenjpeg \ --enable-libopenmpt \ @@ -903,7 +862,6 @@ cp -a doc/examples/{*.c,Makefile,README} _doc/examples/ %endif --enable-openal \ --disable-openssl \ - --enable-postproc \ --enable-pthreads \ --enable-sdl2 \ --enable-shared \ @@ -1004,6 +962,9 @@ rm -rf %{buildroot}%{_datadir} %changelog +* Sun Nov 02 2025 Neal Gompa - 8.0-1 +- Rebase to version 8.0 + * Sun Nov 02 2025 Dominik Mierzejewski - 7.1.2-3 - Re-enable openal support (dropped by accident in commit 5917b714, resolves rhbz#2404091) diff --git a/sources b/sources index 7ed04be..088db29 100644 --- a/sources +++ b/sources @@ -1,3 +1,3 @@ -SHA512 (ffmpeg-7.1.2.tar.xz) = 181e6415da359e3addbc448ff09b5cebe57d9c37106e5125c41f484adebc250502fc9efe150cb117d7378e20830715035be94c2ba4ad7c369b18af85f1a4ca20 -SHA512 (ffmpeg-7.1.2.tar.xz.asc) = b0358cea13be070a0d41b42e98c5df17ab8794b86a5f8b2a4bf0043e608a21b02fdbaad2bc3318457a9c43ef0d3c823509234ffd7292e6ea49b1eff951663f58 +SHA512 (ffmpeg-8.0.tar.xz) = 96f01fc3b881e208e8d35d858b2f60627f298b06103195e3e753b1c6429810d7a484d4daeebad6d0810172616383d103dfb5fcadc4512726c3719800d24a3fde +SHA512 (ffmpeg-8.0.tar.xz.asc) = a3faf35b62d149dd7a8f77a417b4046c50216972696fd8a573538550f29000d53b80caa5d7b81778c65dbb2980482cb111b13afc5ff70934f46cbafc3c4fd639 SHA512 (ffmpeg.keyring) = 9b36506835db36f776b7ddb53ad6fa9e915e6ca2f9c7cfebe8eb45513e1036a985283590a840ca313a111bf35dc3731f68885aaafb1fb7011ec433cc119e5165 From 28d758506e4d08e63e430a3798c7984b98df0b40 Mon Sep 17 00:00:00 2001 From: Dominik 'Rathann' Mierzejewski Date: Tue, 4 Nov 2025 13:50:01 +0100 Subject: [PATCH 90/95] bootstrap for chromaprint --- ffmpeg.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ffmpeg.spec b/ffmpeg.spec index d3cc161..46a22aa 100644 --- a/ffmpeg.spec +++ b/ffmpeg.spec @@ -2,7 +2,7 @@ %bcond all_codecs 0 # Break dependency cycles by disabling certain optional dependencies. -%bcond bootstrap 0 +%bcond bootstrap 1 # If building with all codecs, then set the pkg_suffix to %%nil. # We can't handle this with a conditional, as srpm From 333dc69736d36d2d166ff5a676080531ac889660 Mon Sep 17 00:00:00 2001 From: Dominik 'Rathann' Mierzejewski Date: Tue, 4 Nov 2025 13:51:34 +0100 Subject: [PATCH 91/95] unbootstrap, rebuild with new chromaprint --- ffmpeg.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ffmpeg.spec b/ffmpeg.spec index 46a22aa..d3cc161 100644 --- a/ffmpeg.spec +++ b/ffmpeg.spec @@ -2,7 +2,7 @@ %bcond all_codecs 0 # Break dependency cycles by disabling certain optional dependencies. -%bcond bootstrap 1 +%bcond bootstrap 0 # If building with all codecs, then set the pkg_suffix to %%nil. # We can't handle this with a conditional, as srpm From 2364ea43f4ab637a1a88ec7bf26c79c081b2fdda Mon Sep 17 00:00:00 2001 From: Neal Gompa Date: Fri, 14 Nov 2025 08:12:10 -0500 Subject: [PATCH 92/95] Disable lc3 only on RHEL 10 --- ffmpeg.spec | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/ffmpeg.spec b/ffmpeg.spec index d3cc161..69d7b41 100644 --- a/ffmpeg.spec +++ b/ffmpeg.spec @@ -47,13 +47,11 @@ # Disable dependencies not available or wanted on RHEL/EPEL %bcond chromaprint 0 %bcond flite 0 -%bcond lc3 0 %else # Break chromaprint dependency cycle (Fedora-only): # ffmpeg (libavcodec-free) → chromaprint → ffmpeg %bcond chromaprint %{?with_bootstrap:0}%{!?with_bootstrap:1} %bcond flite 1 -%bcond lc3 1 %endif %if 0%{?rhel} && 0%{?rhel} <= 9 @@ -65,6 +63,14 @@ %bcond placebo 1 %endif +%if 0%{?el10} +# Disable temporarily while we want for liblc3 to be upgraded +# Cf. https://issues.redhat.com/browse/RHEL-127169 +%bcond lc3 0 +%else +%bcond lc3 1 +%endif + # For using an alternative build of EVC codecs %bcond evc_main 0 @@ -99,7 +105,7 @@ Name: ffmpeg %global pkg_name %{name}%{?pkg_suffix} Version: 8.0 -Release: 1%{?dist} +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/ @@ -962,6 +968,9 @@ rm -rf %{buildroot}%{_datadir} %changelog +* Fri Nov 14 2025 Neal Gompa - 8.0-2 +- Disable lc3 only on RHEL 10 + * Sun Nov 02 2025 Neal Gompa - 8.0-1 - Rebase to version 8.0 From 2cb206c8d54ecfd9f267acec127a749eeb849c18 Mon Sep 17 00:00:00 2001 From: Dominik 'Rathann' Mierzejewski Date: Fri, 21 Nov 2025 10:12:19 +0100 Subject: [PATCH 93/95] Update to 8.0.1 (resolves rhbz#2416044) --- ffmpeg.spec | 7 +++++-- sources | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/ffmpeg.spec b/ffmpeg.spec index 69d7b41..e679685 100644 --- a/ffmpeg.spec +++ b/ffmpeg.spec @@ -104,8 +104,8 @@ Name: ffmpeg %global pkg_name %{name}%{?pkg_suffix} -Version: 8.0 -Release: 2%{?dist} +Version: 8.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/ @@ -968,6 +968,9 @@ rm -rf %{buildroot}%{_datadir} %changelog +* Fri Nov 21 2025 Dominik Mierzejewski - 8.0.1-1 +- Update to 8.0.1 (resolves rhbz#2416044) + * Fri Nov 14 2025 Neal Gompa - 8.0-2 - Disable lc3 only on RHEL 10 diff --git a/sources b/sources index 088db29..193e4da 100644 --- a/sources +++ b/sources @@ -1,3 +1,3 @@ -SHA512 (ffmpeg-8.0.tar.xz) = 96f01fc3b881e208e8d35d858b2f60627f298b06103195e3e753b1c6429810d7a484d4daeebad6d0810172616383d103dfb5fcadc4512726c3719800d24a3fde -SHA512 (ffmpeg-8.0.tar.xz.asc) = a3faf35b62d149dd7a8f77a417b4046c50216972696fd8a573538550f29000d53b80caa5d7b81778c65dbb2980482cb111b13afc5ff70934f46cbafc3c4fd639 +SHA512 (ffmpeg-8.0.1.tar.xz) = 7af5cd1c7ba04f8d7ea1b54b64b9c235f2a606dc0c18d25cfdf20958bcad4851d3265b4894fc6ba5dd205c2309971c7e7fb890ee1d64e0a41a3faf159f77957f +SHA512 (ffmpeg-8.0.1.tar.xz.asc) = f56e9e89ecdf9f12e3dae90b52289e5d09bfbfc0f6e13aaf17da9330c138fdb62b132f856c2fd16f5d9f5d6bcf1725602c8781c3e5f07bda6ce1306c379792ab SHA512 (ffmpeg.keyring) = 9b36506835db36f776b7ddb53ad6fa9e915e6ca2f9c7cfebe8eb45513e1036a985283590a840ca313a111bf35dc3731f68885aaafb1fb7011ec433cc119e5165 From 081db52026945d8a8a7976618cf75da87025cf5f Mon Sep 17 00:00:00 2001 From: Neal Gompa Date: Fri, 21 Nov 2025 06:07:44 -0500 Subject: [PATCH 94/95] Split configure step to conf stage --- ffmpeg.spec | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ffmpeg.spec b/ffmpeg.spec index e679685..95df96b 100644 --- a/ffmpeg.spec +++ b/ffmpeg.spec @@ -692,7 +692,7 @@ sed -i "s|check_host_cflags -O3|check_host_cflags %{optflags}|" configure install -m0755 -d _doc/examples cp -a doc/examples/{*.c,Makefile,README} _doc/examples/ -%build +%conf %set_build_flags # This is not a normal configure script, don't use %%configure @@ -942,6 +942,9 @@ for i in H264 HEVC; do done %endif +%build +%set_build_flags + %make_build V=1 %make_build documentation V=1 %make_build alltools V=1 @@ -970,6 +973,7 @@ rm -rf %{buildroot}%{_datadir} %changelog * Fri Nov 21 2025 Dominik Mierzejewski - 8.0.1-1 - Update to 8.0.1 (resolves rhbz#2416044) +- Split configure step to conf stage * Fri Nov 14 2025 Neal Gompa - 8.0-2 - Disable lc3 only on RHEL 10 From 62079f0ff3ba9a41d498e04627021f5a8d7653cb Mon Sep 17 00:00:00 2001 From: Marcin Juszkiewicz Date: Thu, 4 Dec 2025 18:15:51 +0100 Subject: [PATCH 95/95] disable dc1394 and ffnvcodec on risc-v --- ffmpeg.spec | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ffmpeg.spec b/ffmpeg.spec index 95df96b..fa9a894 100644 --- a/ffmpeg.spec +++ b/ffmpeg.spec @@ -35,7 +35,7 @@ %bcond vmaf 0 %endif -%ifarch s390 s390x +%ifarch s390 s390x riscv64 %bcond dc1394 0 %bcond ffnvcodec 0 %else @@ -105,7 +105,7 @@ Name: ffmpeg %global pkg_name %{name}%{?pkg_suffix} Version: 8.0.1 -Release: 1%{?dist} +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/ @@ -971,6 +971,9 @@ rm -rf %{buildroot}%{_datadir} %changelog +* Thu Dec 04 2025 Marcin Juszkiewicz - 8.0.1-2 +- disable dc1394 and ffnvcodec on risc-v + * Fri Nov 21 2025 Dominik Mierzejewski - 8.0.1-1 - Update to 8.0.1 (resolves rhbz#2416044) - Split configure step to conf stage