ffmpeg-devel
Threads by month
- ----- 2026 -----
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
June 2026
- 35 participants
- 380 discussions
PR #23553 opened by Kacper Michajłow (kasper93)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/23553
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/23553.patch
From 4090717e0c80cf521d3aee09ab16ef0692fa5dc0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Kacper=20Michaj=C5=82ow?= <kasper93(a)gmail.com>
Date: Mon, 22 Jun 2026 13:08:37 +0200
Subject: [PATCH 1/3] avcodec/dxva2: map 4:2:0 12-bit to P012 surfaces
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Select P012 as the D3D11VA/DXVA2 frames sw_format for YUV420P12 content
and map it to DXGI_FORMAT_P016, so 12-bit 4:2:0 hardware decoding can
allocate a usable surface.
Signed-off-by: Kacper Michajłow <kasper93(a)gmail.com>
---
libavcodec/dxva2.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/libavcodec/dxva2.c b/libavcodec/dxva2.c
index a282e6c0c7..da9b0bc834 100644
--- a/libavcodec/dxva2.c
+++ b/libavcodec/dxva2.c
@@ -458,6 +458,7 @@ static DXGI_FORMAT d3d11va_map_sw_to_hw_format(enum AVPixelFormat pix_fmt)
switch (pix_fmt) {
case AV_PIX_FMT_NV12: return DXGI_FORMAT_NV12;
case AV_PIX_FMT_P010: return DXGI_FORMAT_P010;
+ case AV_PIX_FMT_P012: return DXGI_FORMAT_P016;
case AV_PIX_FMT_YUV420P: return DXGI_FORMAT_420_OPAQUE;
default: return DXGI_FORMAT_UNKNOWN;
}
@@ -627,8 +628,11 @@ int ff_dxva2_common_frame_params(AVCodecContext *avctx,
else
num_surfaces += 2;
- frames_ctx->sw_format = avctx->sw_pix_fmt == AV_PIX_FMT_YUV420P10 ?
- AV_PIX_FMT_P010 : AV_PIX_FMT_NV12;
+ switch (avctx->sw_pix_fmt) {
+ case AV_PIX_FMT_YUV420P10: frames_ctx->sw_format = AV_PIX_FMT_P010; break;
+ case AV_PIX_FMT_YUV420P12: frames_ctx->sw_format = AV_PIX_FMT_P012; break;
+ default: frames_ctx->sw_format = AV_PIX_FMT_NV12; break;
+ }
frames_ctx->width = FFALIGN(avctx->coded_width, surface_alignment);
frames_ctx->height = FFALIGN(avctx->coded_height, surface_alignment);
frames_ctx->initial_pool_size = num_surfaces;
--
2.52.0
From e3d71739ce3a52e9c7771406b4372790e19d7dc6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Kacper=20Michaj=C5=82ow?= <kasper93(a)gmail.com>
Date: Mon, 22 Jun 2026 13:08:50 +0200
Subject: [PATCH 2/3] avcodec/dxva2: add AV1 Profile 2 decoder GUIDs
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Add the AV1 Professional (Profile 2) decoder GUIDs, including the
dedicated 12-bit 4:2:0 mode, so D3D11VA/DXVA2 can match a decoder for
Profile 2 streams.
Signed-off-by: Kacper Michajłow <kasper93(a)gmail.com>
---
libavcodec/dxva2.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/libavcodec/dxva2.c b/libavcodec/dxva2.c
index da9b0bc834..8f09fb6c44 100644
--- a/libavcodec/dxva2.c
+++ b/libavcodec/dxva2.c
@@ -47,6 +47,9 @@ DEFINE_GUID(ff_DXVA2_ModeHEVC_VLD_Main10,0x107af0e0, 0xef1a,0x4d19,0xab,0xa8,0x6
DEFINE_GUID(ff_DXVA2_ModeVP9_VLD_Profile0,0x463707f8,0xa1d0,0x4585,0x87,0x6d,0x83,0xaa,0x6d,0x60,0xb8,0x9e);
DEFINE_GUID(ff_DXVA2_ModeVP9_VLD_10bit_Profile2,0xa4c749ef,0x6ecf,0x48aa,0x84,0x48,0x50,0xa7,0xa1,0x16,0x5f,0xf7);
DEFINE_GUID(ff_DXVA2_ModeAV1_VLD_Profile0,0xb8be4ccb,0xcf53,0x46ba,0x8d,0x59,0xd6,0xb8,0xa6,0xda,0x5d,0x2a);
+DEFINE_GUID(ff_DXVA2_ModeAV1_VLD_Profile2,0x0c5f2aa1,0xe541,0x4089,0xbb,0x7b,0x98,0x11,0x0a,0x19,0xd7,0xc8);
+DEFINE_GUID(ff_DXVA2_ModeAV1_VLD_12bit_Profile2,0x17127009,0xa00f,0x4ce1,0x99,0x4e,0xbf,0x40,0x81,0xf6,0xf3,0xf0);
+DEFINE_GUID(ff_DXVA2_ModeAV1_VLD_12bit_Profile2_420,0x2d80bed6,0x9cac,0x4835,0x9e,0x91,0x32,0x7b,0xbc,0x4f,0x9e,0xe8);
DEFINE_GUID(ff_DXVA2_NoEncrypt, 0x1b81beD0, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);
DEFINE_GUID(ff_GUID_NULL, 0x00000000, 0x0000,0x0000,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00);
DEFINE_GUID(ff_IID_IDirectXVideoDecoderService, 0xfc51a551,0xd5e7,0x11d9,0xaf,0x55,0x00,0x05,0x4e,0x43,0xff,0x02);
@@ -76,6 +79,8 @@ static const int prof_vp9_profile2[] = {AV_PROFILE_VP9_2,
AV_PROFILE_UNKNOWN};
static const int prof_av1_profile0[] = {AV_PROFILE_AV1_MAIN,
AV_PROFILE_UNKNOWN};
+static const int prof_av1_profile2[] = {AV_PROFILE_AV1_PROFESSIONAL,
+ AV_PROFILE_UNKNOWN};
static const dxva_mode dxva_modes[] = {
/* MPEG-2 */
@@ -103,7 +108,10 @@ static const dxva_mode dxva_modes[] = {
{ &ff_DXVA2_ModeVP9_VLD_10bit_Profile2, AV_CODEC_ID_VP9, prof_vp9_profile2 },
/* AV1 */
- { &ff_DXVA2_ModeAV1_VLD_Profile0, AV_CODEC_ID_AV1, prof_av1_profile0 },
+ { &ff_DXVA2_ModeAV1_VLD_Profile0, AV_CODEC_ID_AV1, prof_av1_profile0 },
+ { &ff_DXVA2_ModeAV1_VLD_12bit_Profile2_420, AV_CODEC_ID_AV1, prof_av1_profile2 },
+ { &ff_DXVA2_ModeAV1_VLD_12bit_Profile2, AV_CODEC_ID_AV1, prof_av1_profile2 },
+ { &ff_DXVA2_ModeAV1_VLD_Profile2, AV_CODEC_ID_AV1, prof_av1_profile2 },
{ NULL, 0 },
};
--
2.52.0
From 78e0dc8e740474a15cb99fa4d870ac6b92bb3f9d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Kacper=20Michaj=C5=82ow?= <kasper93(a)gmail.com>
Date: Mon, 22 Jun 2026 13:08:51 +0200
Subject: [PATCH 3/3] avcodec/av1dec: allow D3D11VA for 12-bit 4:2:0
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Offer the D3D11VA hwaccel pixel formats for YUV420P12 (AV1 Profile 2),
enabling hardware decoding of 12-bit 4:2:0 streams on capable devices.
Signed-off-by: Kacper Michajłow <kasper93(a)gmail.com>
---
libavcodec/av1dec.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/libavcodec/av1dec.c b/libavcodec/av1dec.c
index 424bbfc431..6bbc34d4bc 100644
--- a/libavcodec/av1dec.c
+++ b/libavcodec/av1dec.c
@@ -608,6 +608,10 @@ static int get_pixel_format(AVCodecContext *avctx)
#endif
break;
case AV_PIX_FMT_YUV420P12:
+#if CONFIG_AV1_D3D11VA_HWACCEL
+ *fmtp++ = AV_PIX_FMT_D3D11VA_VLD;
+ *fmtp++ = AV_PIX_FMT_D3D11;
+#endif
#if CONFIG_AV1_VULKAN_HWACCEL
*fmtp++ = AV_PIX_FMT_VULKAN;
#endif
--
2.52.0
1
0
[PR] avutil/hwcontext_d3d11va: support native P016 format (PR #23552)
by Kacper Michajłow 22 Jun '26
by Kacper Michajłow 22 Jun '26
22 Jun '26
PR #23552 opened by Kacper Michajłow (kasper93)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/23552
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/23552.patch
Map DXGI_FORMAT_P016 to AV_PIX_FMT_P016 and keep the 12-bit P012 as a
compatibility entry, matching how Y216 and Y416 already expose both their
native 16-bit and 12-bit variants.
From e703db2da3518a48c84a517dc31f300149b05654 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Kacper=20Michaj=C5=82ow?= <kasper93(a)gmail.com>
Date: Mon, 22 Jun 2026 12:19:19 +0200
Subject: [PATCH] avutil/hwcontext_d3d11va: support native P016 format
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Map DXGI_FORMAT_P016 to AV_PIX_FMT_P016 and keep the 12-bit P012 as a
compatibility entry, matching how Y216 and Y416 already expose both their
native 16-bit and 12-bit variants.
Signed-off-by: Kacper Michajłow <kasper93(a)gmail.com>
---
libavutil/hwcontext_d3d11va.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/libavutil/hwcontext_d3d11va.c b/libavutil/hwcontext_d3d11va.c
index 418fe9dfda..834c2ce3dd 100644
--- a/libavutil/hwcontext_d3d11va.c
+++ b/libavutil/hwcontext_d3d11va.c
@@ -103,11 +103,12 @@ static const struct {
{ DXGI_FORMAT_YUY2, AV_PIX_FMT_YUYV422 },
{ DXGI_FORMAT_Y210, AV_PIX_FMT_Y210 },
{ DXGI_FORMAT_Y410, AV_PIX_FMT_XV30 },
- { DXGI_FORMAT_P016, AV_PIX_FMT_P012 },
+ { DXGI_FORMAT_P016, AV_PIX_FMT_P016 },
{ DXGI_FORMAT_Y216, AV_PIX_FMT_Y216 },
{ DXGI_FORMAT_Y416, AV_PIX_FMT_XV48 },
// There is no 12bit pixel format defined in DXGI_FORMAT*, use 16bit to compatible
// with 12 bit AV_PIX_FMT* formats.
+ { DXGI_FORMAT_P016, AV_PIX_FMT_P012 },
{ DXGI_FORMAT_Y216, AV_PIX_FMT_Y212 },
{ DXGI_FORMAT_Y416, AV_PIX_FMT_XV36 },
// Special opaque formats. The pix_fmt is merely a place holder, as the
--
2.52.0
1
0
PR #2 opened by michaelni
URL: https://code.ffmpeg.org/FFmpeg/web/pulls/2
Patch URL: https://code.ffmpeg.org/FFmpeg/web/pulls/2.patch
Signed-off-by: Michael Niedermayer <michael(a)niedermayer.cc>
From e2fec87df2a4da485e377d9f58c8997aaf821e70 Mon Sep 17 00:00:00 2001
From: Michael Niedermayer <michael(a)niedermayer.cc>
Date: Mon, 22 Jun 2026 02:42:02 +0200
Subject: [PATCH] web/security: Explain where to report CVE#s
Signed-off-by: Michael Niedermayer <michael(a)niedermayer.cc>
---
src/security | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/src/security b/src/security
index 8861ee8..a5e489c 100644
--- a/src/security
+++ b/src/security
@@ -20,6 +20,16 @@ And that you provide a easy to use testcase. Automated submissions are not accep
<li>Any CVE identifier or other related identifier, if available.</li>
</ol>
+<h3>Contributing missing CVE identifiers</h3>
+<p>The list of CVEs on this page is maintained by the FFmpeg community. If you register a CVE or find one missing from the lists below, please help keep it up to date:</p>
+
+<h4>Before the fix has been backported to release branches</h4>
+<p>Please email <a href="mailto:ffmpeg-security@ffmpeg.org">ffmpeg-security(a)ffmpeg.org</a> with the CVE identifier and the git commit that fixes it.</p>
+
+<h4>After the fix has been backported</h4>
+<p>Please <a href="https://code.ffmpeg.org/FFmpeg/web/pulls">open a pull request</a> against the web repository to add the entry to the relevant section(s) of this page.</p>
+
+
<h2>FFmpeg git master</h2>
<p>
Fixes following vulnerabilities:
--
2.52.0
1
0
21 Jun '26
PR #23549 opened by Timo Rothenpieler (BtbN)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/23549
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/23549.patch
cherry picked from commit 4d9cdf82ee36a7da4f065821c86165fe565aeac2
From 32782865b282f566b1fccf5d580b3c6617defe2f Mon Sep 17 00:00:00 2001
From: Patrice Dumas <pertusus(a)free.fr>
Date: Fri, 1 Nov 2024 15:57:07 +0100
Subject: [PATCH] doc/t2h: Support texinfo 7.1 and 7.2 pretest
Here is a proposed patch for portability of doc/t2h.pm for GNU Texinfo
7.1 and 7.1.90 (7.2 pretest). I tested against 7.1 and 7.1.90 (7.2
pretest). There is a difference in the headings compared to the website
version, maybe related to FA_ICONS not being set the same, but the
result seems correct.
I also renamed $element to $output_unit in ffmpeg_heading_command as in
new equivalent makeinfo/texi2any code the $element variable is the
$command variable in ffmpeg_heading_command, which is very confusing. I
left as is the $command variable to have a patch easier to read, but it
could make sense to rename $command as $element later on.
The patch could also have effects with Texinfo 7.0, since some of the
changes are for that version, but that probably never show up because it
is for situations that may not exist in ffmpeg manuals (for example
@node without sectioning command), or because the code is robust to some
missing information (case of $heading_level in ffmpeg_heading_command
that was not set, as far as I can tell).
Signed-off-by: James Almer <jamrial(a)gmail.com>
(cherry picked from commit 4d9cdf82ee36a7da4f065821c86165fe565aeac2)
---
doc/t2h.pm | 169 ++++++++++++++++++++++++++++++++++++++++-------------
1 file changed, 129 insertions(+), 40 deletions(-)
diff --git a/doc/t2h.pm b/doc/t2h.pm
index b7485e1f1e..4875d66305 100644
--- a/doc/t2h.pm
+++ b/doc/t2h.pm
@@ -54,12 +54,24 @@ sub get_formatting_function($$) {
}
# determine texinfo version
-my $program_version_num = version->declare(ff_get_conf('PACKAGE_VERSION'))->numify;
+my $package_version = ff_get_conf('PACKAGE_VERSION');
+$package_version =~ s/\+dev$//;
+my $program_version_num = version->declare($package_version)->numify;
my $program_version_6_8 = $program_version_num >= 6.008000;
# no navigation elements
ff_set_from_init_file('HEADERS', 0);
+my %sectioning_commands = %Texinfo::Common::sectioning_commands;
+if (scalar(keys(%sectioning_commands)) == 0) {
+ %sectioning_commands = %Texinfo::Commands::sectioning_heading_commands;
+}
+
+my %root_commands = %Texinfo::Common::root_commands;
+if (scalar(keys(%root_commands)) == 0) {
+ %root_commands = %Texinfo::Commands::root_commands;
+}
+
sub ffmpeg_heading_command($$$$$)
{
my $self = shift;
@@ -77,6 +89,9 @@ sub ffmpeg_heading_command($$$$$)
return $result;
}
+ # no need to set it as the $element_id is output unconditionally
+ my $heading_id;
+
my $element_id = $self->command_id($command);
$result .= "<a name=\"$element_id\"></a>\n"
if (defined($element_id) and $element_id ne '');
@@ -84,24 +99,40 @@ sub ffmpeg_heading_command($$$$$)
print STDERR "Process $command "
.Texinfo::Structuring::_print_root_command_texi($command)."\n"
if ($self->get_conf('DEBUG'));
- my $element;
- if ($Texinfo::Common::root_commands{$command->{'cmdname'}}
- and $command->{'parent'}
- and $command->{'parent'}->{'type'}
- and $command->{'parent'}->{'type'} eq 'element') {
- $element = $command->{'parent'};
+ my $output_unit;
+ if ($root_commands{$command->{'cmdname'}}) {
+ if ($command->{'associated_unit'}) {
+ $output_unit = $command->{'associated_unit'};
+ } elsif ($command->{'structure'}
+ and $command->{'structure'}->{'associated_unit'}) {
+ $output_unit = $command->{'structure'}->{'associated_unit'};
+ } elsif ($command->{'parent'}
+ and $command->{'parent'}->{'type'}
+ and $command->{'parent'}->{'type'} eq 'element') {
+ $output_unit = $command->{'parent'};
+ }
}
- if ($element) {
+
+ if ($output_unit) {
$result .= &{get_formatting_function($self, 'format_element_header')}($self, $cmdname,
- $command, $element);
+ $command, $output_unit);
}
my $heading_level;
# node is used as heading if there is nothing else.
if ($cmdname eq 'node') {
- if (!$element or (!$element->{'extra'}->{'section'}
- and $element->{'extra'}->{'node'}
- and $element->{'extra'}->{'node'} eq $command
+ if (!$output_unit or
+ (((!$output_unit->{'extra'}->{'section'}
+ and $output_unit->{'extra'}->{'node'}
+ and $output_unit->{'extra'}->{'node'} eq $command)
+ or
+ ((($output_unit->{'extra'}->{'unit_command'}
+ and $output_unit->{'extra'}->{'unit_command'} eq $command)
+ or
+ ($output_unit->{'unit_command'}
+ and $output_unit->{'unit_command'} eq $command))
+ and $command->{'extra'}
+ and not $command->{'extra'}->{'associated_section'}))
# bogus node may not have been normalized
and defined($command->{'extra'}->{'normalized'}))) {
if ($command->{'extra'}->{'normalized'} eq 'Top') {
@@ -111,7 +142,15 @@ sub ffmpeg_heading_command($$$$$)
}
}
} else {
- $heading_level = $command->{'level'};
+ if (defined($command->{'extra'})
+ and defined($command->{'extra'}->{'section_level'})) {
+ $heading_level = $command->{'extra'}->{'section_level'};
+ } elsif ($command->{'structure'}
+ and defined($command->{'structure'}->{'section_level'})) {
+ $heading_level = $command->{'structure'}->{'section_level'};
+ } else {
+ $heading_level = $command->{'level'};
+ }
}
my $heading = $self->command_text($command);
@@ -119,8 +158,8 @@ sub ffmpeg_heading_command($$$$$)
# if there is an error in the node.
if (defined($heading) and $heading ne '' and defined($heading_level)) {
- if ($Texinfo::Common::root_commands{$cmdname}
- and $Texinfo::Common::sectioning_commands{$cmdname}) {
+ if ($root_commands{$cmdname}
+ and $sectioning_commands{$cmdname}) {
my $content_href = $self->command_contents_href($command, 'contents',
$self->{'current_filename'});
if ($content_href) {
@@ -140,7 +179,13 @@ sub ffmpeg_heading_command($$$$$)
}
}
- if ($self->in_preformatted()) {
+ my $in_preformatted;
+ if ($program_version_num >= 7.001090) {
+ $in_preformatted = $self->in_preformatted_context();
+ } else {
+ $in_preformatted = $self->in_preformatted();
+ }
+ if ($in_preformatted) {
$result .= $heading."\n";
} else {
# if the level was changed, set the command name right
@@ -149,21 +194,25 @@ sub ffmpeg_heading_command($$$$$)
$cmdname
= $Texinfo::Common::level_to_structuring_command{$cmdname}->[$heading_level];
}
- # format_heading_text expects an array of headings for texinfo >= 7.0
if ($program_version_num >= 7.000000) {
- $heading = [$heading];
- }
- $result .= &{get_formatting_function($self,'format_heading_text')}(
+ $result .= &{get_formatting_function($self,'format_heading_text')}($self,
+ $cmdname, [$cmdname], $heading,
+ $heading_level +$self->get_conf('CHAPTER_HEADER_LEVEL') -1,
+ $heading_id, $command);
+
+ } else {
+ $result .= &{get_formatting_function($self,'format_heading_text')}(
$self, $cmdname, $heading,
$heading_level +
$self->get_conf('CHAPTER_HEADER_LEVEL') - 1, $command);
+ }
}
}
$result .= $content if (defined($content));
return $result;
}
-foreach my $command (keys(%Texinfo::Common::sectioning_commands), 'node') {
+foreach my $command (keys(%sectioning_commands), 'node') {
texinfo_register_command_formatting($command, \&ffmpeg_heading_command);
}
@@ -188,28 +237,56 @@ sub ffmpeg_begin_file($$$)
my $filename = shift;
my $element = shift;
- my $command;
- if ($element and $self->get_conf('SPLIT')) {
- $command = $self->element_command($element);
+ my ($element_command, $node_command, $command_for_title);
+ if ($element) {
+ if ($element->{'unit_command'}) {
+ $element_command = $element->{'unit_command'};
+ } elsif ($self->can('tree_unit_element_command')) {
+ $element_command = $self->tree_unit_element_command($element);
+ } elsif ($self->can('tree_unit_element_command')) {
+ $element_command = $self->element_command($element);
+ }
+
+ $node_command = $element_command;
+ if ($element_command and $element_command->{'cmdname'}
+ and $element_command->{'cmdname'} ne 'node'
+ and $element_command->{'extra'}
+ and $element_command->{'extra'}->{'associated_node'}) {
+ $node_command = $element_command->{'extra'}->{'associated_node'};
+ }
+
+ $command_for_title = $element_command if ($self->get_conf('SPLIT'));
}
- my ($title, $description, $encoding, $date, $css_lines,
- $doctype, $bodytext, $copying_comment, $after_body_open,
- $extra_head, $program_and_version, $program_homepage,
+ my ($title, $description, $keywords, $encoding, $date, $css_lines, $doctype,
+ $root_html_element_attributes, $body_attributes, $copying_comment,
+ $after_body_open, $extra_head, $program_and_version, $program_homepage,
$program, $generator);
- if ($program_version_num >= 7.000000) {
- ($title, $description, $encoding, $date, $css_lines,
- $doctype, $bodytext, $copying_comment, $after_body_open,
+ if ($program_version_num >= 7.001090) {
+ ($title, $description, $keywords, $encoding, $date, $css_lines, $doctype,
+ $root_html_element_attributes, $body_attributes, $copying_comment,
+ $after_body_open, $extra_head, $program_and_version, $program_homepage,
+ $program, $generator) = $self->_file_header_information($command_for_title,
+ $filename);
+ } elsif ($program_version_num >= 7.000000) {
+ ($title, $description, $encoding, $date, $css_lines, $doctype,
+ $root_html_element_attributes, $copying_comment, $after_body_open,
$extra_head, $program_and_version, $program_homepage,
- $program, $generator) = $self->_file_header_information($command);
+ $program, $generator) = $self->_file_header_information($command_for_title,
+ $filename);
} else {
($title, $description, $encoding, $date, $css_lines,
- $doctype, $bodytext, $copying_comment, $after_body_open,
- $extra_head, $program_and_version, $program_homepage,
- $program, $generator) = $self->_file_header_informations($command);
+ $doctype, $root_html_element_attributes, $copying_comment,
+ $after_body_open, $extra_head, $program_and_version, $program_homepage,
+ $program, $generator) = $self->_file_header_informations($command_for_title);
}
- my $links = $self->_get_links ($filename, $element);
+ my $links;
+ if ($program_version_num >= 7.000000) {
+ $links = $self->_get_links($filename, $element, $node_command);
+ } else {
+ $links = $self->_get_links ($filename, $element);
+ }
my $head1 = $ENV{"FFMPEG_HEADER1"} || <<EOT;
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
@@ -252,13 +329,25 @@ sub ffmpeg_program_string($)
if (defined($self->get_conf('PROGRAM'))
and $self->get_conf('PROGRAM') ne ''
and defined($self->get_conf('PACKAGE_URL'))) {
- return $self->convert_tree(
+ if ($program_version_num >= 7.001090) {
+ return $self->convert_tree(
+ $self->cdt('This document was generated using @uref{{program_homepage}, @emph{{program}}}.',
+ { 'program_homepage' => {'text' => $self->get_conf('PACKAGE_URL')},
+ 'program' => {'text' => $self->get_conf('PROGRAM') }}));
+ } else {
+ return $self->convert_tree(
$self->gdt('This document was generated using @uref{{program_homepage}, @emph{{program}}}.',
- { 'program_homepage' => $self->get_conf('PACKAGE_URL'),
- 'program' => $self->get_conf('PROGRAM') }));
+ { 'program_homepage' => {'text' => $self->get_conf('PACKAGE_URL')},
+ 'program' => {'text' => $self->get_conf('PROGRAM') }}));
+ }
} else {
- return $self->convert_tree(
- $self->gdt('This document was generated automatically.'));
+ if ($program_version_num >= 7.001090) {
+ return $self->convert_tree(
+ $self->cdt('This document was generated automatically.'));
+ } else {
+ return $self->convert_tree(
+ $self->gdt('This document was generated automatically.'));
+ }
}
}
if ($program_version_6_8) {
--
2.52.0
1
0
21 Jun '26
PR #23548 opened by Timo Rothenpieler (BtbN)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/23548
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/23548.patch
cherry picked from commit 4d9cdf82ee36a7da4f065821c86165fe565aeac2
From 244465b96a2342ecfa9adf97cbdd95a952adc4cb Mon Sep 17 00:00:00 2001
From: Patrice Dumas <pertusus(a)free.fr>
Date: Fri, 1 Nov 2024 15:57:07 +0100
Subject: [PATCH] doc/t2h: Support texinfo 7.1 and 7.2 pretest
Here is a proposed patch for portability of doc/t2h.pm for GNU Texinfo
7.1 and 7.1.90 (7.2 pretest). I tested against 7.1 and 7.1.90 (7.2
pretest). There is a difference in the headings compared to the website
version, maybe related to FA_ICONS not being set the same, but the
result seems correct.
I also renamed $element to $output_unit in ffmpeg_heading_command as in
new equivalent makeinfo/texi2any code the $element variable is the
$command variable in ffmpeg_heading_command, which is very confusing. I
left as is the $command variable to have a patch easier to read, but it
could make sense to rename $command as $element later on.
The patch could also have effects with Texinfo 7.0, since some of the
changes are for that version, but that probably never show up because it
is for situations that may not exist in ffmpeg manuals (for example
@node without sectioning command), or because the code is robust to some
missing information (case of $heading_level in ffmpeg_heading_command
that was not set, as far as I can tell).
Signed-off-by: James Almer <jamrial(a)gmail.com>
(cherry picked from commit 4d9cdf82ee36a7da4f065821c86165fe565aeac2)
---
doc/t2h.pm | 169 ++++++++++++++++++++++++++++++++++++++++-------------
1 file changed, 129 insertions(+), 40 deletions(-)
diff --git a/doc/t2h.pm b/doc/t2h.pm
index b7485e1f1e..4875d66305 100644
--- a/doc/t2h.pm
+++ b/doc/t2h.pm
@@ -54,12 +54,24 @@ sub get_formatting_function($$) {
}
# determine texinfo version
-my $program_version_num = version->declare(ff_get_conf('PACKAGE_VERSION'))->numify;
+my $package_version = ff_get_conf('PACKAGE_VERSION');
+$package_version =~ s/\+dev$//;
+my $program_version_num = version->declare($package_version)->numify;
my $program_version_6_8 = $program_version_num >= 6.008000;
# no navigation elements
ff_set_from_init_file('HEADERS', 0);
+my %sectioning_commands = %Texinfo::Common::sectioning_commands;
+if (scalar(keys(%sectioning_commands)) == 0) {
+ %sectioning_commands = %Texinfo::Commands::sectioning_heading_commands;
+}
+
+my %root_commands = %Texinfo::Common::root_commands;
+if (scalar(keys(%root_commands)) == 0) {
+ %root_commands = %Texinfo::Commands::root_commands;
+}
+
sub ffmpeg_heading_command($$$$$)
{
my $self = shift;
@@ -77,6 +89,9 @@ sub ffmpeg_heading_command($$$$$)
return $result;
}
+ # no need to set it as the $element_id is output unconditionally
+ my $heading_id;
+
my $element_id = $self->command_id($command);
$result .= "<a name=\"$element_id\"></a>\n"
if (defined($element_id) and $element_id ne '');
@@ -84,24 +99,40 @@ sub ffmpeg_heading_command($$$$$)
print STDERR "Process $command "
.Texinfo::Structuring::_print_root_command_texi($command)."\n"
if ($self->get_conf('DEBUG'));
- my $element;
- if ($Texinfo::Common::root_commands{$command->{'cmdname'}}
- and $command->{'parent'}
- and $command->{'parent'}->{'type'}
- and $command->{'parent'}->{'type'} eq 'element') {
- $element = $command->{'parent'};
+ my $output_unit;
+ if ($root_commands{$command->{'cmdname'}}) {
+ if ($command->{'associated_unit'}) {
+ $output_unit = $command->{'associated_unit'};
+ } elsif ($command->{'structure'}
+ and $command->{'structure'}->{'associated_unit'}) {
+ $output_unit = $command->{'structure'}->{'associated_unit'};
+ } elsif ($command->{'parent'}
+ and $command->{'parent'}->{'type'}
+ and $command->{'parent'}->{'type'} eq 'element') {
+ $output_unit = $command->{'parent'};
+ }
}
- if ($element) {
+
+ if ($output_unit) {
$result .= &{get_formatting_function($self, 'format_element_header')}($self, $cmdname,
- $command, $element);
+ $command, $output_unit);
}
my $heading_level;
# node is used as heading if there is nothing else.
if ($cmdname eq 'node') {
- if (!$element or (!$element->{'extra'}->{'section'}
- and $element->{'extra'}->{'node'}
- and $element->{'extra'}->{'node'} eq $command
+ if (!$output_unit or
+ (((!$output_unit->{'extra'}->{'section'}
+ and $output_unit->{'extra'}->{'node'}
+ and $output_unit->{'extra'}->{'node'} eq $command)
+ or
+ ((($output_unit->{'extra'}->{'unit_command'}
+ and $output_unit->{'extra'}->{'unit_command'} eq $command)
+ or
+ ($output_unit->{'unit_command'}
+ and $output_unit->{'unit_command'} eq $command))
+ and $command->{'extra'}
+ and not $command->{'extra'}->{'associated_section'}))
# bogus node may not have been normalized
and defined($command->{'extra'}->{'normalized'}))) {
if ($command->{'extra'}->{'normalized'} eq 'Top') {
@@ -111,7 +142,15 @@ sub ffmpeg_heading_command($$$$$)
}
}
} else {
- $heading_level = $command->{'level'};
+ if (defined($command->{'extra'})
+ and defined($command->{'extra'}->{'section_level'})) {
+ $heading_level = $command->{'extra'}->{'section_level'};
+ } elsif ($command->{'structure'}
+ and defined($command->{'structure'}->{'section_level'})) {
+ $heading_level = $command->{'structure'}->{'section_level'};
+ } else {
+ $heading_level = $command->{'level'};
+ }
}
my $heading = $self->command_text($command);
@@ -119,8 +158,8 @@ sub ffmpeg_heading_command($$$$$)
# if there is an error in the node.
if (defined($heading) and $heading ne '' and defined($heading_level)) {
- if ($Texinfo::Common::root_commands{$cmdname}
- and $Texinfo::Common::sectioning_commands{$cmdname}) {
+ if ($root_commands{$cmdname}
+ and $sectioning_commands{$cmdname}) {
my $content_href = $self->command_contents_href($command, 'contents',
$self->{'current_filename'});
if ($content_href) {
@@ -140,7 +179,13 @@ sub ffmpeg_heading_command($$$$$)
}
}
- if ($self->in_preformatted()) {
+ my $in_preformatted;
+ if ($program_version_num >= 7.001090) {
+ $in_preformatted = $self->in_preformatted_context();
+ } else {
+ $in_preformatted = $self->in_preformatted();
+ }
+ if ($in_preformatted) {
$result .= $heading."\n";
} else {
# if the level was changed, set the command name right
@@ -149,21 +194,25 @@ sub ffmpeg_heading_command($$$$$)
$cmdname
= $Texinfo::Common::level_to_structuring_command{$cmdname}->[$heading_level];
}
- # format_heading_text expects an array of headings for texinfo >= 7.0
if ($program_version_num >= 7.000000) {
- $heading = [$heading];
- }
- $result .= &{get_formatting_function($self,'format_heading_text')}(
+ $result .= &{get_formatting_function($self,'format_heading_text')}($self,
+ $cmdname, [$cmdname], $heading,
+ $heading_level +$self->get_conf('CHAPTER_HEADER_LEVEL') -1,
+ $heading_id, $command);
+
+ } else {
+ $result .= &{get_formatting_function($self,'format_heading_text')}(
$self, $cmdname, $heading,
$heading_level +
$self->get_conf('CHAPTER_HEADER_LEVEL') - 1, $command);
+ }
}
}
$result .= $content if (defined($content));
return $result;
}
-foreach my $command (keys(%Texinfo::Common::sectioning_commands), 'node') {
+foreach my $command (keys(%sectioning_commands), 'node') {
texinfo_register_command_formatting($command, \&ffmpeg_heading_command);
}
@@ -188,28 +237,56 @@ sub ffmpeg_begin_file($$$)
my $filename = shift;
my $element = shift;
- my $command;
- if ($element and $self->get_conf('SPLIT')) {
- $command = $self->element_command($element);
+ my ($element_command, $node_command, $command_for_title);
+ if ($element) {
+ if ($element->{'unit_command'}) {
+ $element_command = $element->{'unit_command'};
+ } elsif ($self->can('tree_unit_element_command')) {
+ $element_command = $self->tree_unit_element_command($element);
+ } elsif ($self->can('tree_unit_element_command')) {
+ $element_command = $self->element_command($element);
+ }
+
+ $node_command = $element_command;
+ if ($element_command and $element_command->{'cmdname'}
+ and $element_command->{'cmdname'} ne 'node'
+ and $element_command->{'extra'}
+ and $element_command->{'extra'}->{'associated_node'}) {
+ $node_command = $element_command->{'extra'}->{'associated_node'};
+ }
+
+ $command_for_title = $element_command if ($self->get_conf('SPLIT'));
}
- my ($title, $description, $encoding, $date, $css_lines,
- $doctype, $bodytext, $copying_comment, $after_body_open,
- $extra_head, $program_and_version, $program_homepage,
+ my ($title, $description, $keywords, $encoding, $date, $css_lines, $doctype,
+ $root_html_element_attributes, $body_attributes, $copying_comment,
+ $after_body_open, $extra_head, $program_and_version, $program_homepage,
$program, $generator);
- if ($program_version_num >= 7.000000) {
- ($title, $description, $encoding, $date, $css_lines,
- $doctype, $bodytext, $copying_comment, $after_body_open,
+ if ($program_version_num >= 7.001090) {
+ ($title, $description, $keywords, $encoding, $date, $css_lines, $doctype,
+ $root_html_element_attributes, $body_attributes, $copying_comment,
+ $after_body_open, $extra_head, $program_and_version, $program_homepage,
+ $program, $generator) = $self->_file_header_information($command_for_title,
+ $filename);
+ } elsif ($program_version_num >= 7.000000) {
+ ($title, $description, $encoding, $date, $css_lines, $doctype,
+ $root_html_element_attributes, $copying_comment, $after_body_open,
$extra_head, $program_and_version, $program_homepage,
- $program, $generator) = $self->_file_header_information($command);
+ $program, $generator) = $self->_file_header_information($command_for_title,
+ $filename);
} else {
($title, $description, $encoding, $date, $css_lines,
- $doctype, $bodytext, $copying_comment, $after_body_open,
- $extra_head, $program_and_version, $program_homepage,
- $program, $generator) = $self->_file_header_informations($command);
+ $doctype, $root_html_element_attributes, $copying_comment,
+ $after_body_open, $extra_head, $program_and_version, $program_homepage,
+ $program, $generator) = $self->_file_header_informations($command_for_title);
}
- my $links = $self->_get_links ($filename, $element);
+ my $links;
+ if ($program_version_num >= 7.000000) {
+ $links = $self->_get_links($filename, $element, $node_command);
+ } else {
+ $links = $self->_get_links ($filename, $element);
+ }
my $head1 = $ENV{"FFMPEG_HEADER1"} || <<EOT;
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
@@ -252,13 +329,25 @@ sub ffmpeg_program_string($)
if (defined($self->get_conf('PROGRAM'))
and $self->get_conf('PROGRAM') ne ''
and defined($self->get_conf('PACKAGE_URL'))) {
- return $self->convert_tree(
+ if ($program_version_num >= 7.001090) {
+ return $self->convert_tree(
+ $self->cdt('This document was generated using @uref{{program_homepage}, @emph{{program}}}.',
+ { 'program_homepage' => {'text' => $self->get_conf('PACKAGE_URL')},
+ 'program' => {'text' => $self->get_conf('PROGRAM') }}));
+ } else {
+ return $self->convert_tree(
$self->gdt('This document was generated using @uref{{program_homepage}, @emph{{program}}}.',
- { 'program_homepage' => $self->get_conf('PACKAGE_URL'),
- 'program' => $self->get_conf('PROGRAM') }));
+ { 'program_homepage' => {'text' => $self->get_conf('PACKAGE_URL')},
+ 'program' => {'text' => $self->get_conf('PROGRAM') }}));
+ }
} else {
- return $self->convert_tree(
- $self->gdt('This document was generated automatically.'));
+ if ($program_version_num >= 7.001090) {
+ return $self->convert_tree(
+ $self->cdt('This document was generated automatically.'));
+ } else {
+ return $self->convert_tree(
+ $self->gdt('This document was generated automatically.'));
+ }
}
}
if ($program_version_6_8) {
--
2.52.0
1
0
21 Jun '26
PR #23547 opened by Timo Rothenpieler (BtbN)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/23547
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/23547.patch
cherry picked from commit 4d9cdf82ee36a7da4f065821c86165fe565aeac2
From 6de5cea239e509cde9a4fe2ab54df855edafa5ee Mon Sep 17 00:00:00 2001
From: Patrice Dumas <pertusus(a)free.fr>
Date: Fri, 1 Nov 2024 15:57:07 +0100
Subject: [PATCH] doc/t2h: Support texinfo 7.1 and 7.2 pretest
Here is a proposed patch for portability of doc/t2h.pm for GNU Texinfo
7.1 and 7.1.90 (7.2 pretest). I tested against 7.1 and 7.1.90 (7.2
pretest). There is a difference in the headings compared to the website
version, maybe related to FA_ICONS not being set the same, but the
result seems correct.
I also renamed $element to $output_unit in ffmpeg_heading_command as in
new equivalent makeinfo/texi2any code the $element variable is the
$command variable in ffmpeg_heading_command, which is very confusing. I
left as is the $command variable to have a patch easier to read, but it
could make sense to rename $command as $element later on.
The patch could also have effects with Texinfo 7.0, since some of the
changes are for that version, but that probably never show up because it
is for situations that may not exist in ffmpeg manuals (for example
@node without sectioning command), or because the code is robust to some
missing information (case of $heading_level in ffmpeg_heading_command
that was not set, as far as I can tell).
Signed-off-by: James Almer <jamrial(a)gmail.com>
(cherry picked from commit 4d9cdf82ee36a7da4f065821c86165fe565aeac2)
---
doc/t2h.pm | 169 ++++++++++++++++++++++++++++++++++++++++-------------
1 file changed, 129 insertions(+), 40 deletions(-)
diff --git a/doc/t2h.pm b/doc/t2h.pm
index b7485e1f1e..4875d66305 100644
--- a/doc/t2h.pm
+++ b/doc/t2h.pm
@@ -54,12 +54,24 @@ sub get_formatting_function($$) {
}
# determine texinfo version
-my $program_version_num = version->declare(ff_get_conf('PACKAGE_VERSION'))->numify;
+my $package_version = ff_get_conf('PACKAGE_VERSION');
+$package_version =~ s/\+dev$//;
+my $program_version_num = version->declare($package_version)->numify;
my $program_version_6_8 = $program_version_num >= 6.008000;
# no navigation elements
ff_set_from_init_file('HEADERS', 0);
+my %sectioning_commands = %Texinfo::Common::sectioning_commands;
+if (scalar(keys(%sectioning_commands)) == 0) {
+ %sectioning_commands = %Texinfo::Commands::sectioning_heading_commands;
+}
+
+my %root_commands = %Texinfo::Common::root_commands;
+if (scalar(keys(%root_commands)) == 0) {
+ %root_commands = %Texinfo::Commands::root_commands;
+}
+
sub ffmpeg_heading_command($$$$$)
{
my $self = shift;
@@ -77,6 +89,9 @@ sub ffmpeg_heading_command($$$$$)
return $result;
}
+ # no need to set it as the $element_id is output unconditionally
+ my $heading_id;
+
my $element_id = $self->command_id($command);
$result .= "<a name=\"$element_id\"></a>\n"
if (defined($element_id) and $element_id ne '');
@@ -84,24 +99,40 @@ sub ffmpeg_heading_command($$$$$)
print STDERR "Process $command "
.Texinfo::Structuring::_print_root_command_texi($command)."\n"
if ($self->get_conf('DEBUG'));
- my $element;
- if ($Texinfo::Common::root_commands{$command->{'cmdname'}}
- and $command->{'parent'}
- and $command->{'parent'}->{'type'}
- and $command->{'parent'}->{'type'} eq 'element') {
- $element = $command->{'parent'};
+ my $output_unit;
+ if ($root_commands{$command->{'cmdname'}}) {
+ if ($command->{'associated_unit'}) {
+ $output_unit = $command->{'associated_unit'};
+ } elsif ($command->{'structure'}
+ and $command->{'structure'}->{'associated_unit'}) {
+ $output_unit = $command->{'structure'}->{'associated_unit'};
+ } elsif ($command->{'parent'}
+ and $command->{'parent'}->{'type'}
+ and $command->{'parent'}->{'type'} eq 'element') {
+ $output_unit = $command->{'parent'};
+ }
}
- if ($element) {
+
+ if ($output_unit) {
$result .= &{get_formatting_function($self, 'format_element_header')}($self, $cmdname,
- $command, $element);
+ $command, $output_unit);
}
my $heading_level;
# node is used as heading if there is nothing else.
if ($cmdname eq 'node') {
- if (!$element or (!$element->{'extra'}->{'section'}
- and $element->{'extra'}->{'node'}
- and $element->{'extra'}->{'node'} eq $command
+ if (!$output_unit or
+ (((!$output_unit->{'extra'}->{'section'}
+ and $output_unit->{'extra'}->{'node'}
+ and $output_unit->{'extra'}->{'node'} eq $command)
+ or
+ ((($output_unit->{'extra'}->{'unit_command'}
+ and $output_unit->{'extra'}->{'unit_command'} eq $command)
+ or
+ ($output_unit->{'unit_command'}
+ and $output_unit->{'unit_command'} eq $command))
+ and $command->{'extra'}
+ and not $command->{'extra'}->{'associated_section'}))
# bogus node may not have been normalized
and defined($command->{'extra'}->{'normalized'}))) {
if ($command->{'extra'}->{'normalized'} eq 'Top') {
@@ -111,7 +142,15 @@ sub ffmpeg_heading_command($$$$$)
}
}
} else {
- $heading_level = $command->{'level'};
+ if (defined($command->{'extra'})
+ and defined($command->{'extra'}->{'section_level'})) {
+ $heading_level = $command->{'extra'}->{'section_level'};
+ } elsif ($command->{'structure'}
+ and defined($command->{'structure'}->{'section_level'})) {
+ $heading_level = $command->{'structure'}->{'section_level'};
+ } else {
+ $heading_level = $command->{'level'};
+ }
}
my $heading = $self->command_text($command);
@@ -119,8 +158,8 @@ sub ffmpeg_heading_command($$$$$)
# if there is an error in the node.
if (defined($heading) and $heading ne '' and defined($heading_level)) {
- if ($Texinfo::Common::root_commands{$cmdname}
- and $Texinfo::Common::sectioning_commands{$cmdname}) {
+ if ($root_commands{$cmdname}
+ and $sectioning_commands{$cmdname}) {
my $content_href = $self->command_contents_href($command, 'contents',
$self->{'current_filename'});
if ($content_href) {
@@ -140,7 +179,13 @@ sub ffmpeg_heading_command($$$$$)
}
}
- if ($self->in_preformatted()) {
+ my $in_preformatted;
+ if ($program_version_num >= 7.001090) {
+ $in_preformatted = $self->in_preformatted_context();
+ } else {
+ $in_preformatted = $self->in_preformatted();
+ }
+ if ($in_preformatted) {
$result .= $heading."\n";
} else {
# if the level was changed, set the command name right
@@ -149,21 +194,25 @@ sub ffmpeg_heading_command($$$$$)
$cmdname
= $Texinfo::Common::level_to_structuring_command{$cmdname}->[$heading_level];
}
- # format_heading_text expects an array of headings for texinfo >= 7.0
if ($program_version_num >= 7.000000) {
- $heading = [$heading];
- }
- $result .= &{get_formatting_function($self,'format_heading_text')}(
+ $result .= &{get_formatting_function($self,'format_heading_text')}($self,
+ $cmdname, [$cmdname], $heading,
+ $heading_level +$self->get_conf('CHAPTER_HEADER_LEVEL') -1,
+ $heading_id, $command);
+
+ } else {
+ $result .= &{get_formatting_function($self,'format_heading_text')}(
$self, $cmdname, $heading,
$heading_level +
$self->get_conf('CHAPTER_HEADER_LEVEL') - 1, $command);
+ }
}
}
$result .= $content if (defined($content));
return $result;
}
-foreach my $command (keys(%Texinfo::Common::sectioning_commands), 'node') {
+foreach my $command (keys(%sectioning_commands), 'node') {
texinfo_register_command_formatting($command, \&ffmpeg_heading_command);
}
@@ -188,28 +237,56 @@ sub ffmpeg_begin_file($$$)
my $filename = shift;
my $element = shift;
- my $command;
- if ($element and $self->get_conf('SPLIT')) {
- $command = $self->element_command($element);
+ my ($element_command, $node_command, $command_for_title);
+ if ($element) {
+ if ($element->{'unit_command'}) {
+ $element_command = $element->{'unit_command'};
+ } elsif ($self->can('tree_unit_element_command')) {
+ $element_command = $self->tree_unit_element_command($element);
+ } elsif ($self->can('tree_unit_element_command')) {
+ $element_command = $self->element_command($element);
+ }
+
+ $node_command = $element_command;
+ if ($element_command and $element_command->{'cmdname'}
+ and $element_command->{'cmdname'} ne 'node'
+ and $element_command->{'extra'}
+ and $element_command->{'extra'}->{'associated_node'}) {
+ $node_command = $element_command->{'extra'}->{'associated_node'};
+ }
+
+ $command_for_title = $element_command if ($self->get_conf('SPLIT'));
}
- my ($title, $description, $encoding, $date, $css_lines,
- $doctype, $bodytext, $copying_comment, $after_body_open,
- $extra_head, $program_and_version, $program_homepage,
+ my ($title, $description, $keywords, $encoding, $date, $css_lines, $doctype,
+ $root_html_element_attributes, $body_attributes, $copying_comment,
+ $after_body_open, $extra_head, $program_and_version, $program_homepage,
$program, $generator);
- if ($program_version_num >= 7.000000) {
- ($title, $description, $encoding, $date, $css_lines,
- $doctype, $bodytext, $copying_comment, $after_body_open,
+ if ($program_version_num >= 7.001090) {
+ ($title, $description, $keywords, $encoding, $date, $css_lines, $doctype,
+ $root_html_element_attributes, $body_attributes, $copying_comment,
+ $after_body_open, $extra_head, $program_and_version, $program_homepage,
+ $program, $generator) = $self->_file_header_information($command_for_title,
+ $filename);
+ } elsif ($program_version_num >= 7.000000) {
+ ($title, $description, $encoding, $date, $css_lines, $doctype,
+ $root_html_element_attributes, $copying_comment, $after_body_open,
$extra_head, $program_and_version, $program_homepage,
- $program, $generator) = $self->_file_header_information($command);
+ $program, $generator) = $self->_file_header_information($command_for_title,
+ $filename);
} else {
($title, $description, $encoding, $date, $css_lines,
- $doctype, $bodytext, $copying_comment, $after_body_open,
- $extra_head, $program_and_version, $program_homepage,
- $program, $generator) = $self->_file_header_informations($command);
+ $doctype, $root_html_element_attributes, $copying_comment,
+ $after_body_open, $extra_head, $program_and_version, $program_homepage,
+ $program, $generator) = $self->_file_header_informations($command_for_title);
}
- my $links = $self->_get_links ($filename, $element);
+ my $links;
+ if ($program_version_num >= 7.000000) {
+ $links = $self->_get_links($filename, $element, $node_command);
+ } else {
+ $links = $self->_get_links ($filename, $element);
+ }
my $head1 = $ENV{"FFMPEG_HEADER1"} || <<EOT;
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
@@ -252,13 +329,25 @@ sub ffmpeg_program_string($)
if (defined($self->get_conf('PROGRAM'))
and $self->get_conf('PROGRAM') ne ''
and defined($self->get_conf('PACKAGE_URL'))) {
- return $self->convert_tree(
+ if ($program_version_num >= 7.001090) {
+ return $self->convert_tree(
+ $self->cdt('This document was generated using @uref{{program_homepage}, @emph{{program}}}.',
+ { 'program_homepage' => {'text' => $self->get_conf('PACKAGE_URL')},
+ 'program' => {'text' => $self->get_conf('PROGRAM') }}));
+ } else {
+ return $self->convert_tree(
$self->gdt('This document was generated using @uref{{program_homepage}, @emph{{program}}}.',
- { 'program_homepage' => $self->get_conf('PACKAGE_URL'),
- 'program' => $self->get_conf('PROGRAM') }));
+ { 'program_homepage' => {'text' => $self->get_conf('PACKAGE_URL')},
+ 'program' => {'text' => $self->get_conf('PROGRAM') }}));
+ }
} else {
- return $self->convert_tree(
- $self->gdt('This document was generated automatically.'));
+ if ($program_version_num >= 7.001090) {
+ return $self->convert_tree(
+ $self->cdt('This document was generated automatically.'));
+ } else {
+ return $self->convert_tree(
+ $self->gdt('This document was generated automatically.'));
+ }
}
}
if ($program_version_6_8) {
--
2.52.0
1
0
21 Jun '26
PR #23546 opened by Timo Rothenpieler (BtbN)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/23546
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/23546.patch
cherry picked from commit 4d9cdf82ee36a7da4f065821c86165fe565aeac2
From 32291d4ac3fae922591cee11b82318d8d3857be2 Mon Sep 17 00:00:00 2001
From: Patrice Dumas <pertusus(a)free.fr>
Date: Fri, 1 Nov 2024 15:57:07 +0100
Subject: [PATCH] doc/t2h: Support texinfo 7.1 and 7.2 pretest
Here is a proposed patch for portability of doc/t2h.pm for GNU Texinfo
7.1 and 7.1.90 (7.2 pretest). I tested against 7.1 and 7.1.90 (7.2
pretest). There is a difference in the headings compared to the website
version, maybe related to FA_ICONS not being set the same, but the
result seems correct.
I also renamed $element to $output_unit in ffmpeg_heading_command as in
new equivalent makeinfo/texi2any code the $element variable is the
$command variable in ffmpeg_heading_command, which is very confusing. I
left as is the $command variable to have a patch easier to read, but it
could make sense to rename $command as $element later on.
The patch could also have effects with Texinfo 7.0, since some of the
changes are for that version, but that probably never show up because it
is for situations that may not exist in ffmpeg manuals (for example
@node without sectioning command), or because the code is robust to some
missing information (case of $heading_level in ffmpeg_heading_command
that was not set, as far as I can tell).
Signed-off-by: James Almer <jamrial(a)gmail.com>
(cherry picked from commit 4d9cdf82ee36a7da4f065821c86165fe565aeac2)
---
doc/t2h.pm | 169 ++++++++++++++++++++++++++++++++++++++++-------------
1 file changed, 129 insertions(+), 40 deletions(-)
diff --git a/doc/t2h.pm b/doc/t2h.pm
index b7485e1f1e..4875d66305 100644
--- a/doc/t2h.pm
+++ b/doc/t2h.pm
@@ -54,12 +54,24 @@ sub get_formatting_function($$) {
}
# determine texinfo version
-my $program_version_num = version->declare(ff_get_conf('PACKAGE_VERSION'))->numify;
+my $package_version = ff_get_conf('PACKAGE_VERSION');
+$package_version =~ s/\+dev$//;
+my $program_version_num = version->declare($package_version)->numify;
my $program_version_6_8 = $program_version_num >= 6.008000;
# no navigation elements
ff_set_from_init_file('HEADERS', 0);
+my %sectioning_commands = %Texinfo::Common::sectioning_commands;
+if (scalar(keys(%sectioning_commands)) == 0) {
+ %sectioning_commands = %Texinfo::Commands::sectioning_heading_commands;
+}
+
+my %root_commands = %Texinfo::Common::root_commands;
+if (scalar(keys(%root_commands)) == 0) {
+ %root_commands = %Texinfo::Commands::root_commands;
+}
+
sub ffmpeg_heading_command($$$$$)
{
my $self = shift;
@@ -77,6 +89,9 @@ sub ffmpeg_heading_command($$$$$)
return $result;
}
+ # no need to set it as the $element_id is output unconditionally
+ my $heading_id;
+
my $element_id = $self->command_id($command);
$result .= "<a name=\"$element_id\"></a>\n"
if (defined($element_id) and $element_id ne '');
@@ -84,24 +99,40 @@ sub ffmpeg_heading_command($$$$$)
print STDERR "Process $command "
.Texinfo::Structuring::_print_root_command_texi($command)."\n"
if ($self->get_conf('DEBUG'));
- my $element;
- if ($Texinfo::Common::root_commands{$command->{'cmdname'}}
- and $command->{'parent'}
- and $command->{'parent'}->{'type'}
- and $command->{'parent'}->{'type'} eq 'element') {
- $element = $command->{'parent'};
+ my $output_unit;
+ if ($root_commands{$command->{'cmdname'}}) {
+ if ($command->{'associated_unit'}) {
+ $output_unit = $command->{'associated_unit'};
+ } elsif ($command->{'structure'}
+ and $command->{'structure'}->{'associated_unit'}) {
+ $output_unit = $command->{'structure'}->{'associated_unit'};
+ } elsif ($command->{'parent'}
+ and $command->{'parent'}->{'type'}
+ and $command->{'parent'}->{'type'} eq 'element') {
+ $output_unit = $command->{'parent'};
+ }
}
- if ($element) {
+
+ if ($output_unit) {
$result .= &{get_formatting_function($self, 'format_element_header')}($self, $cmdname,
- $command, $element);
+ $command, $output_unit);
}
my $heading_level;
# node is used as heading if there is nothing else.
if ($cmdname eq 'node') {
- if (!$element or (!$element->{'extra'}->{'section'}
- and $element->{'extra'}->{'node'}
- and $element->{'extra'}->{'node'} eq $command
+ if (!$output_unit or
+ (((!$output_unit->{'extra'}->{'section'}
+ and $output_unit->{'extra'}->{'node'}
+ and $output_unit->{'extra'}->{'node'} eq $command)
+ or
+ ((($output_unit->{'extra'}->{'unit_command'}
+ and $output_unit->{'extra'}->{'unit_command'} eq $command)
+ or
+ ($output_unit->{'unit_command'}
+ and $output_unit->{'unit_command'} eq $command))
+ and $command->{'extra'}
+ and not $command->{'extra'}->{'associated_section'}))
# bogus node may not have been normalized
and defined($command->{'extra'}->{'normalized'}))) {
if ($command->{'extra'}->{'normalized'} eq 'Top') {
@@ -111,7 +142,15 @@ sub ffmpeg_heading_command($$$$$)
}
}
} else {
- $heading_level = $command->{'level'};
+ if (defined($command->{'extra'})
+ and defined($command->{'extra'}->{'section_level'})) {
+ $heading_level = $command->{'extra'}->{'section_level'};
+ } elsif ($command->{'structure'}
+ and defined($command->{'structure'}->{'section_level'})) {
+ $heading_level = $command->{'structure'}->{'section_level'};
+ } else {
+ $heading_level = $command->{'level'};
+ }
}
my $heading = $self->command_text($command);
@@ -119,8 +158,8 @@ sub ffmpeg_heading_command($$$$$)
# if there is an error in the node.
if (defined($heading) and $heading ne '' and defined($heading_level)) {
- if ($Texinfo::Common::root_commands{$cmdname}
- and $Texinfo::Common::sectioning_commands{$cmdname}) {
+ if ($root_commands{$cmdname}
+ and $sectioning_commands{$cmdname}) {
my $content_href = $self->command_contents_href($command, 'contents',
$self->{'current_filename'});
if ($content_href) {
@@ -140,7 +179,13 @@ sub ffmpeg_heading_command($$$$$)
}
}
- if ($self->in_preformatted()) {
+ my $in_preformatted;
+ if ($program_version_num >= 7.001090) {
+ $in_preformatted = $self->in_preformatted_context();
+ } else {
+ $in_preformatted = $self->in_preformatted();
+ }
+ if ($in_preformatted) {
$result .= $heading."\n";
} else {
# if the level was changed, set the command name right
@@ -149,21 +194,25 @@ sub ffmpeg_heading_command($$$$$)
$cmdname
= $Texinfo::Common::level_to_structuring_command{$cmdname}->[$heading_level];
}
- # format_heading_text expects an array of headings for texinfo >= 7.0
if ($program_version_num >= 7.000000) {
- $heading = [$heading];
- }
- $result .= &{get_formatting_function($self,'format_heading_text')}(
+ $result .= &{get_formatting_function($self,'format_heading_text')}($self,
+ $cmdname, [$cmdname], $heading,
+ $heading_level +$self->get_conf('CHAPTER_HEADER_LEVEL') -1,
+ $heading_id, $command);
+
+ } else {
+ $result .= &{get_formatting_function($self,'format_heading_text')}(
$self, $cmdname, $heading,
$heading_level +
$self->get_conf('CHAPTER_HEADER_LEVEL') - 1, $command);
+ }
}
}
$result .= $content if (defined($content));
return $result;
}
-foreach my $command (keys(%Texinfo::Common::sectioning_commands), 'node') {
+foreach my $command (keys(%sectioning_commands), 'node') {
texinfo_register_command_formatting($command, \&ffmpeg_heading_command);
}
@@ -188,28 +237,56 @@ sub ffmpeg_begin_file($$$)
my $filename = shift;
my $element = shift;
- my $command;
- if ($element and $self->get_conf('SPLIT')) {
- $command = $self->element_command($element);
+ my ($element_command, $node_command, $command_for_title);
+ if ($element) {
+ if ($element->{'unit_command'}) {
+ $element_command = $element->{'unit_command'};
+ } elsif ($self->can('tree_unit_element_command')) {
+ $element_command = $self->tree_unit_element_command($element);
+ } elsif ($self->can('tree_unit_element_command')) {
+ $element_command = $self->element_command($element);
+ }
+
+ $node_command = $element_command;
+ if ($element_command and $element_command->{'cmdname'}
+ and $element_command->{'cmdname'} ne 'node'
+ and $element_command->{'extra'}
+ and $element_command->{'extra'}->{'associated_node'}) {
+ $node_command = $element_command->{'extra'}->{'associated_node'};
+ }
+
+ $command_for_title = $element_command if ($self->get_conf('SPLIT'));
}
- my ($title, $description, $encoding, $date, $css_lines,
- $doctype, $bodytext, $copying_comment, $after_body_open,
- $extra_head, $program_and_version, $program_homepage,
+ my ($title, $description, $keywords, $encoding, $date, $css_lines, $doctype,
+ $root_html_element_attributes, $body_attributes, $copying_comment,
+ $after_body_open, $extra_head, $program_and_version, $program_homepage,
$program, $generator);
- if ($program_version_num >= 7.000000) {
- ($title, $description, $encoding, $date, $css_lines,
- $doctype, $bodytext, $copying_comment, $after_body_open,
+ if ($program_version_num >= 7.001090) {
+ ($title, $description, $keywords, $encoding, $date, $css_lines, $doctype,
+ $root_html_element_attributes, $body_attributes, $copying_comment,
+ $after_body_open, $extra_head, $program_and_version, $program_homepage,
+ $program, $generator) = $self->_file_header_information($command_for_title,
+ $filename);
+ } elsif ($program_version_num >= 7.000000) {
+ ($title, $description, $encoding, $date, $css_lines, $doctype,
+ $root_html_element_attributes, $copying_comment, $after_body_open,
$extra_head, $program_and_version, $program_homepage,
- $program, $generator) = $self->_file_header_information($command);
+ $program, $generator) = $self->_file_header_information($command_for_title,
+ $filename);
} else {
($title, $description, $encoding, $date, $css_lines,
- $doctype, $bodytext, $copying_comment, $after_body_open,
- $extra_head, $program_and_version, $program_homepage,
- $program, $generator) = $self->_file_header_informations($command);
+ $doctype, $root_html_element_attributes, $copying_comment,
+ $after_body_open, $extra_head, $program_and_version, $program_homepage,
+ $program, $generator) = $self->_file_header_informations($command_for_title);
}
- my $links = $self->_get_links ($filename, $element);
+ my $links;
+ if ($program_version_num >= 7.000000) {
+ $links = $self->_get_links($filename, $element, $node_command);
+ } else {
+ $links = $self->_get_links ($filename, $element);
+ }
my $head1 = $ENV{"FFMPEG_HEADER1"} || <<EOT;
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
@@ -252,13 +329,25 @@ sub ffmpeg_program_string($)
if (defined($self->get_conf('PROGRAM'))
and $self->get_conf('PROGRAM') ne ''
and defined($self->get_conf('PACKAGE_URL'))) {
- return $self->convert_tree(
+ if ($program_version_num >= 7.001090) {
+ return $self->convert_tree(
+ $self->cdt('This document was generated using @uref{{program_homepage}, @emph{{program}}}.',
+ { 'program_homepage' => {'text' => $self->get_conf('PACKAGE_URL')},
+ 'program' => {'text' => $self->get_conf('PROGRAM') }}));
+ } else {
+ return $self->convert_tree(
$self->gdt('This document was generated using @uref{{program_homepage}, @emph{{program}}}.',
- { 'program_homepage' => $self->get_conf('PACKAGE_URL'),
- 'program' => $self->get_conf('PROGRAM') }));
+ { 'program_homepage' => {'text' => $self->get_conf('PACKAGE_URL')},
+ 'program' => {'text' => $self->get_conf('PROGRAM') }}));
+ }
} else {
- return $self->convert_tree(
- $self->gdt('This document was generated automatically.'));
+ if ($program_version_num >= 7.001090) {
+ return $self->convert_tree(
+ $self->cdt('This document was generated automatically.'));
+ } else {
+ return $self->convert_tree(
+ $self->gdt('This document was generated automatically.'));
+ }
}
}
if ($program_version_6_8) {
--
2.52.0
1
0
21 Jun '26
PR #23545 opened by Timo Rothenpieler (BtbN)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/23545
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/23545.patch
cherry picked from commit 4d9cdf82ee36a7da4f065821c86165fe565aeac2
From 9c9784472410ed333daf93884e8dfccd2625ee45 Mon Sep 17 00:00:00 2001
From: Patrice Dumas <pertusus(a)free.fr>
Date: Fri, 1 Nov 2024 15:57:07 +0100
Subject: [PATCH] doc/t2h: Support texinfo 7.1 and 7.2 pretest
Here is a proposed patch for portability of doc/t2h.pm for GNU Texinfo
7.1 and 7.1.90 (7.2 pretest). I tested against 7.1 and 7.1.90 (7.2
pretest). There is a difference in the headings compared to the website
version, maybe related to FA_ICONS not being set the same, but the
result seems correct.
I also renamed $element to $output_unit in ffmpeg_heading_command as in
new equivalent makeinfo/texi2any code the $element variable is the
$command variable in ffmpeg_heading_command, which is very confusing. I
left as is the $command variable to have a patch easier to read, but it
could make sense to rename $command as $element later on.
The patch could also have effects with Texinfo 7.0, since some of the
changes are for that version, but that probably never show up because it
is for situations that may not exist in ffmpeg manuals (for example
@node without sectioning command), or because the code is robust to some
missing information (case of $heading_level in ffmpeg_heading_command
that was not set, as far as I can tell).
Signed-off-by: James Almer <jamrial(a)gmail.com>
(cherry picked from commit 4d9cdf82ee36a7da4f065821c86165fe565aeac2)
---
doc/t2h.pm | 169 ++++++++++++++++++++++++++++++++++++++++-------------
1 file changed, 129 insertions(+), 40 deletions(-)
diff --git a/doc/t2h.pm b/doc/t2h.pm
index b7485e1f1e..4875d66305 100644
--- a/doc/t2h.pm
+++ b/doc/t2h.pm
@@ -54,12 +54,24 @@ sub get_formatting_function($$) {
}
# determine texinfo version
-my $program_version_num = version->declare(ff_get_conf('PACKAGE_VERSION'))->numify;
+my $package_version = ff_get_conf('PACKAGE_VERSION');
+$package_version =~ s/\+dev$//;
+my $program_version_num = version->declare($package_version)->numify;
my $program_version_6_8 = $program_version_num >= 6.008000;
# no navigation elements
ff_set_from_init_file('HEADERS', 0);
+my %sectioning_commands = %Texinfo::Common::sectioning_commands;
+if (scalar(keys(%sectioning_commands)) == 0) {
+ %sectioning_commands = %Texinfo::Commands::sectioning_heading_commands;
+}
+
+my %root_commands = %Texinfo::Common::root_commands;
+if (scalar(keys(%root_commands)) == 0) {
+ %root_commands = %Texinfo::Commands::root_commands;
+}
+
sub ffmpeg_heading_command($$$$$)
{
my $self = shift;
@@ -77,6 +89,9 @@ sub ffmpeg_heading_command($$$$$)
return $result;
}
+ # no need to set it as the $element_id is output unconditionally
+ my $heading_id;
+
my $element_id = $self->command_id($command);
$result .= "<a name=\"$element_id\"></a>\n"
if (defined($element_id) and $element_id ne '');
@@ -84,24 +99,40 @@ sub ffmpeg_heading_command($$$$$)
print STDERR "Process $command "
.Texinfo::Structuring::_print_root_command_texi($command)."\n"
if ($self->get_conf('DEBUG'));
- my $element;
- if ($Texinfo::Common::root_commands{$command->{'cmdname'}}
- and $command->{'parent'}
- and $command->{'parent'}->{'type'}
- and $command->{'parent'}->{'type'} eq 'element') {
- $element = $command->{'parent'};
+ my $output_unit;
+ if ($root_commands{$command->{'cmdname'}}) {
+ if ($command->{'associated_unit'}) {
+ $output_unit = $command->{'associated_unit'};
+ } elsif ($command->{'structure'}
+ and $command->{'structure'}->{'associated_unit'}) {
+ $output_unit = $command->{'structure'}->{'associated_unit'};
+ } elsif ($command->{'parent'}
+ and $command->{'parent'}->{'type'}
+ and $command->{'parent'}->{'type'} eq 'element') {
+ $output_unit = $command->{'parent'};
+ }
}
- if ($element) {
+
+ if ($output_unit) {
$result .= &{get_formatting_function($self, 'format_element_header')}($self, $cmdname,
- $command, $element);
+ $command, $output_unit);
}
my $heading_level;
# node is used as heading if there is nothing else.
if ($cmdname eq 'node') {
- if (!$element or (!$element->{'extra'}->{'section'}
- and $element->{'extra'}->{'node'}
- and $element->{'extra'}->{'node'} eq $command
+ if (!$output_unit or
+ (((!$output_unit->{'extra'}->{'section'}
+ and $output_unit->{'extra'}->{'node'}
+ and $output_unit->{'extra'}->{'node'} eq $command)
+ or
+ ((($output_unit->{'extra'}->{'unit_command'}
+ and $output_unit->{'extra'}->{'unit_command'} eq $command)
+ or
+ ($output_unit->{'unit_command'}
+ and $output_unit->{'unit_command'} eq $command))
+ and $command->{'extra'}
+ and not $command->{'extra'}->{'associated_section'}))
# bogus node may not have been normalized
and defined($command->{'extra'}->{'normalized'}))) {
if ($command->{'extra'}->{'normalized'} eq 'Top') {
@@ -111,7 +142,15 @@ sub ffmpeg_heading_command($$$$$)
}
}
} else {
- $heading_level = $command->{'level'};
+ if (defined($command->{'extra'})
+ and defined($command->{'extra'}->{'section_level'})) {
+ $heading_level = $command->{'extra'}->{'section_level'};
+ } elsif ($command->{'structure'}
+ and defined($command->{'structure'}->{'section_level'})) {
+ $heading_level = $command->{'structure'}->{'section_level'};
+ } else {
+ $heading_level = $command->{'level'};
+ }
}
my $heading = $self->command_text($command);
@@ -119,8 +158,8 @@ sub ffmpeg_heading_command($$$$$)
# if there is an error in the node.
if (defined($heading) and $heading ne '' and defined($heading_level)) {
- if ($Texinfo::Common::root_commands{$cmdname}
- and $Texinfo::Common::sectioning_commands{$cmdname}) {
+ if ($root_commands{$cmdname}
+ and $sectioning_commands{$cmdname}) {
my $content_href = $self->command_contents_href($command, 'contents',
$self->{'current_filename'});
if ($content_href) {
@@ -140,7 +179,13 @@ sub ffmpeg_heading_command($$$$$)
}
}
- if ($self->in_preformatted()) {
+ my $in_preformatted;
+ if ($program_version_num >= 7.001090) {
+ $in_preformatted = $self->in_preformatted_context();
+ } else {
+ $in_preformatted = $self->in_preformatted();
+ }
+ if ($in_preformatted) {
$result .= $heading."\n";
} else {
# if the level was changed, set the command name right
@@ -149,21 +194,25 @@ sub ffmpeg_heading_command($$$$$)
$cmdname
= $Texinfo::Common::level_to_structuring_command{$cmdname}->[$heading_level];
}
- # format_heading_text expects an array of headings for texinfo >= 7.0
if ($program_version_num >= 7.000000) {
- $heading = [$heading];
- }
- $result .= &{get_formatting_function($self,'format_heading_text')}(
+ $result .= &{get_formatting_function($self,'format_heading_text')}($self,
+ $cmdname, [$cmdname], $heading,
+ $heading_level +$self->get_conf('CHAPTER_HEADER_LEVEL') -1,
+ $heading_id, $command);
+
+ } else {
+ $result .= &{get_formatting_function($self,'format_heading_text')}(
$self, $cmdname, $heading,
$heading_level +
$self->get_conf('CHAPTER_HEADER_LEVEL') - 1, $command);
+ }
}
}
$result .= $content if (defined($content));
return $result;
}
-foreach my $command (keys(%Texinfo::Common::sectioning_commands), 'node') {
+foreach my $command (keys(%sectioning_commands), 'node') {
texinfo_register_command_formatting($command, \&ffmpeg_heading_command);
}
@@ -188,28 +237,56 @@ sub ffmpeg_begin_file($$$)
my $filename = shift;
my $element = shift;
- my $command;
- if ($element and $self->get_conf('SPLIT')) {
- $command = $self->element_command($element);
+ my ($element_command, $node_command, $command_for_title);
+ if ($element) {
+ if ($element->{'unit_command'}) {
+ $element_command = $element->{'unit_command'};
+ } elsif ($self->can('tree_unit_element_command')) {
+ $element_command = $self->tree_unit_element_command($element);
+ } elsif ($self->can('tree_unit_element_command')) {
+ $element_command = $self->element_command($element);
+ }
+
+ $node_command = $element_command;
+ if ($element_command and $element_command->{'cmdname'}
+ and $element_command->{'cmdname'} ne 'node'
+ and $element_command->{'extra'}
+ and $element_command->{'extra'}->{'associated_node'}) {
+ $node_command = $element_command->{'extra'}->{'associated_node'};
+ }
+
+ $command_for_title = $element_command if ($self->get_conf('SPLIT'));
}
- my ($title, $description, $encoding, $date, $css_lines,
- $doctype, $bodytext, $copying_comment, $after_body_open,
- $extra_head, $program_and_version, $program_homepage,
+ my ($title, $description, $keywords, $encoding, $date, $css_lines, $doctype,
+ $root_html_element_attributes, $body_attributes, $copying_comment,
+ $after_body_open, $extra_head, $program_and_version, $program_homepage,
$program, $generator);
- if ($program_version_num >= 7.000000) {
- ($title, $description, $encoding, $date, $css_lines,
- $doctype, $bodytext, $copying_comment, $after_body_open,
+ if ($program_version_num >= 7.001090) {
+ ($title, $description, $keywords, $encoding, $date, $css_lines, $doctype,
+ $root_html_element_attributes, $body_attributes, $copying_comment,
+ $after_body_open, $extra_head, $program_and_version, $program_homepage,
+ $program, $generator) = $self->_file_header_information($command_for_title,
+ $filename);
+ } elsif ($program_version_num >= 7.000000) {
+ ($title, $description, $encoding, $date, $css_lines, $doctype,
+ $root_html_element_attributes, $copying_comment, $after_body_open,
$extra_head, $program_and_version, $program_homepage,
- $program, $generator) = $self->_file_header_information($command);
+ $program, $generator) = $self->_file_header_information($command_for_title,
+ $filename);
} else {
($title, $description, $encoding, $date, $css_lines,
- $doctype, $bodytext, $copying_comment, $after_body_open,
- $extra_head, $program_and_version, $program_homepage,
- $program, $generator) = $self->_file_header_informations($command);
+ $doctype, $root_html_element_attributes, $copying_comment,
+ $after_body_open, $extra_head, $program_and_version, $program_homepage,
+ $program, $generator) = $self->_file_header_informations($command_for_title);
}
- my $links = $self->_get_links ($filename, $element);
+ my $links;
+ if ($program_version_num >= 7.000000) {
+ $links = $self->_get_links($filename, $element, $node_command);
+ } else {
+ $links = $self->_get_links ($filename, $element);
+ }
my $head1 = $ENV{"FFMPEG_HEADER1"} || <<EOT;
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
@@ -252,13 +329,25 @@ sub ffmpeg_program_string($)
if (defined($self->get_conf('PROGRAM'))
and $self->get_conf('PROGRAM') ne ''
and defined($self->get_conf('PACKAGE_URL'))) {
- return $self->convert_tree(
+ if ($program_version_num >= 7.001090) {
+ return $self->convert_tree(
+ $self->cdt('This document was generated using @uref{{program_homepage}, @emph{{program}}}.',
+ { 'program_homepage' => {'text' => $self->get_conf('PACKAGE_URL')},
+ 'program' => {'text' => $self->get_conf('PROGRAM') }}));
+ } else {
+ return $self->convert_tree(
$self->gdt('This document was generated using @uref{{program_homepage}, @emph{{program}}}.',
- { 'program_homepage' => $self->get_conf('PACKAGE_URL'),
- 'program' => $self->get_conf('PROGRAM') }));
+ { 'program_homepage' => {'text' => $self->get_conf('PACKAGE_URL')},
+ 'program' => {'text' => $self->get_conf('PROGRAM') }}));
+ }
} else {
- return $self->convert_tree(
- $self->gdt('This document was generated automatically.'));
+ if ($program_version_num >= 7.001090) {
+ return $self->convert_tree(
+ $self->cdt('This document was generated automatically.'));
+ } else {
+ return $self->convert_tree(
+ $self->gdt('This document was generated automatically.'));
+ }
}
}
if ($program_version_6_8) {
--
2.52.0
1
0
PR #23544 opened by michaelni
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/23544
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/23544.patch
Did this so i can branch 9.0 in june
very heavily based on: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/22455
This includes avpriv-packet-list API unavpriven that mkver wanted
also it defers a few things to a future bump
From eb698de355d6567e5acdda42273090644ca131e9 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
Date: Tue, 3 Mar 2026 18:19:21 +0100
Subject: [PATCH 01/33] avdevice: Remove deprecated FF_API_ALSA_CHANNELS
Deprecated since 2025-02-01.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
---
libavdevice/alsa.h | 3 ---
libavdevice/alsa_dec.c | 10 ----------
libavdevice/version_major.h | 2 --
3 files changed, 15 deletions(-)
diff --git a/libavdevice/alsa.h b/libavdevice/alsa.h
index d3dfa478c5..f6a85616a8 100644
--- a/libavdevice/alsa.h
+++ b/libavdevice/alsa.h
@@ -52,9 +52,6 @@ typedef struct AlsaData {
int frame_size; ///< bytes per sample * channels
int period_size; ///< preferred size for reads and writes, in frames
int sample_rate; ///< sample rate set by user
-#if FF_API_ALSA_CHANNELS
- int channels; ///< number of channels set by user
-#endif
AVChannelLayout ch_layout; ///< Channel layout set by user
int last_period;
TimeFilter *timefilter;
diff --git a/libavdevice/alsa_dec.c b/libavdevice/alsa_dec.c
index 63409a7785..e3f73911de 100644
--- a/libavdevice/alsa_dec.c
+++ b/libavdevice/alsa_dec.c
@@ -73,13 +73,6 @@ static av_cold int audio_read_header(AVFormatContext *s1)
}
codec_id = s1->audio_codec_id;
-#if FF_API_ALSA_CHANNELS
- if (s->channels > 0) {
- av_channel_layout_uninit(&s->ch_layout);
- s->ch_layout.nb_channels = s->channels;
- }
-#endif
-
ret = ff_alsa_open(s1, SND_PCM_STREAM_CAPTURE, &s->sample_rate, &s->ch_layout,
&codec_id);
if (ret < 0) {
@@ -157,9 +150,6 @@ static int audio_get_device_list(AVFormatContext *h, AVDeviceInfoList *device_li
static const AVOption options[] = {
{ "sample_rate", "", offsetof(AlsaData, sample_rate), AV_OPT_TYPE_INT, {.i64 = 48000}, 1, INT_MAX, AV_OPT_FLAG_DECODING_PARAM },
-#if FF_API_ALSA_CHANNELS
- { "channels", "", offsetof(AlsaData, channels), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_DEPRECATED },
-#endif
{ "ch_layout", "", offsetof(AlsaData, ch_layout), AV_OPT_TYPE_CHLAYOUT, {.str = "2C"}, INT_MIN, INT_MAX, AV_OPT_FLAG_DECODING_PARAM },
{ NULL },
};
diff --git a/libavdevice/version_major.h b/libavdevice/version_major.h
index 191511cdcc..2df1f3a2d4 100644
--- a/libavdevice/version_major.h
+++ b/libavdevice/version_major.h
@@ -33,6 +33,4 @@
* the public API and may change, break or disappear at any time.
*/
-#define FF_API_ALSA_CHANNELS (LIBAVDEVICE_VERSION_MAJOR < 63)
-
#endif /* AVDEVICE_VERSION_MAJOR_H */
--
2.52.0
From d47511a764b1600fbfe0dd750c829a506ba01a1e Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
Date: Tue, 3 Mar 2026 18:29:08 +0100
Subject: [PATCH 02/33] avfilter: Remove deprecated FF_API_BUFFERSINK_OPTS
Deprecated since 2024-09-30.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
---
libavfilter/buffersink.c | 186 ------------------------------------
libavfilter/version_major.h | 1 -
2 files changed, 187 deletions(-)
diff --git a/libavfilter/buffersink.c b/libavfilter/buffersink.c
index 75b93cee30..dda3abf385 100644
--- a/libavfilter/buffersink.c
+++ b/libavfilter/buffersink.c
@@ -46,17 +46,6 @@ typedef struct BufferSinkContext {
unsigned frame_size;
/* only used for video */
-#if FF_API_BUFFERSINK_OPTS
- enum AVPixelFormat *pixel_fmts; ///< list of accepted pixel formats
- int pixel_fmts_size;
- enum AVColorSpace *color_spaces; ///< list of accepted color spaces
- int color_spaces_size;
- enum AVColorRange *color_ranges; ///< list of accepted color ranges
- int color_ranges_size;
- enum AVAlphaMode *alpha_modes; ///< list of accepted alpha modes
- int alpha_modes_size;
-#endif
-
enum AVPixelFormat *pixel_formats;
unsigned nb_pixel_formats;
@@ -70,15 +59,6 @@ typedef struct BufferSinkContext {
unsigned nb_alphamodes;
/* only used for audio */
-#if FF_API_BUFFERSINK_OPTS
- enum AVSampleFormat *sample_fmts; ///< list of accepted sample formats
- int sample_fmts_size;
- char *channel_layouts_str; ///< list of accepted channel layouts
- int all_channel_counts;
- int *sample_rates; ///< list of accepted sample rates
- int sample_rates_size;
-#endif
-
enum AVSampleFormat *sample_formats;
unsigned nb_sample_formats;
@@ -168,79 +148,6 @@ static av_cold int common_init(AVFilterContext *ctx)
{
BufferSinkContext *buf = ctx->priv;
-#if FF_API_BUFFERSINK_OPTS
-
-#define CHECK_LIST_SIZE(field) \
- if (buf->field ## _size % sizeof(*buf->field)) { \
- av_log(ctx, AV_LOG_ERROR, "Invalid size for " #field ": %d, " \
- "should be multiple of %d\n", \
- buf->field ## _size, (int)sizeof(*buf->field)); \
- return AVERROR(EINVAL); \
- }
-
- if (ctx->input_pads[0].type == AVMEDIA_TYPE_VIDEO) {
- if ((buf->pixel_fmts_size || buf->color_spaces_size || buf->color_ranges_size || buf->alpha_modes_size) &&
- (buf->nb_pixel_formats || buf->nb_colorspaces || buf->nb_colorranges || buf->nb_alphamodes)) {
- av_log(ctx, AV_LOG_ERROR, "Cannot combine old and new format lists\n");
- return AVERROR(EINVAL);
- }
-
- CHECK_LIST_SIZE(pixel_fmts)
- CHECK_LIST_SIZE(color_spaces)
- CHECK_LIST_SIZE(color_ranges)
- CHECK_LIST_SIZE(alpha_modes)
- } else {
- if ((buf->sample_fmts_size || buf->channel_layouts_str || buf->sample_rates_size) &&
- (buf->nb_sample_formats || buf->nb_samplerates || buf->nb_channel_layouts)) {
- av_log(ctx, AV_LOG_ERROR, "Cannot combine old and new format lists\n");
- return AVERROR(EINVAL);
- }
-
- CHECK_LIST_SIZE(sample_fmts)
- CHECK_LIST_SIZE(sample_rates)
-
- if (buf->channel_layouts_str) {
- const char *cur = buf->channel_layouts_str;
-
- if (buf->all_channel_counts)
- av_log(ctx, AV_LOG_WARNING,
- "Conflicting all_channel_counts and list in options\n");
-
- while (cur) {
- void *tmp;
- char *next = strchr(cur, '|');
- if (next)
- *next++ = 0;
-
- // +2 for the new element and terminator
- tmp = av_realloc_array(buf->channel_layouts, buf->nb_channel_layouts + 2,
- sizeof(*buf->channel_layouts));
- if (!tmp)
- return AVERROR(ENOMEM);
-
- buf->channel_layouts = tmp;
- memset(&buf->channel_layouts[buf->nb_channel_layouts], 0,
- sizeof(*buf->channel_layouts) * 2);
- buf->nb_channel_layouts++;
-
- int ret = av_channel_layout_from_string(&buf->channel_layouts[buf->nb_channel_layouts - 1], cur);
- if (ret < 0) {
- av_log(ctx, AV_LOG_ERROR, "Error parsing channel layout: %s.\n", cur);
- return ret;
- }
-
- cur = next;
- }
-
- if (buf->nb_channel_layouts)
- buf->channel_layouts[buf->nb_channel_layouts] = (AVChannelLayout){ 0 };
- }
- }
-
-#undef CHECK_LIST_SIZE
-
-#endif
-
buf->warning_limit = 100;
return 0;
}
@@ -385,10 +292,6 @@ const AVFrameSideData *const *av_buffersink_get_side_data(const AVFilterContext
return (const AVFrameSideData *const *)ctx->inputs[0]->side_data;
}
-#if FF_API_BUFFERSINK_OPTS
-#define NB_ITEMS(list) (list ## _size / sizeof(*list))
-#endif
-
static int vsink_query_formats(const AVFilterContext *ctx,
AVFilterFormatsConfig **cfg_in,
AVFilterFormatsConfig **cfg_out)
@@ -396,9 +299,6 @@ static int vsink_query_formats(const AVFilterContext *ctx,
const BufferSinkContext *buf = ctx->priv;
int ret;
-#if FF_API_BUFFERSINK_OPTS
- if (buf->nb_pixel_formats || buf->nb_colorspaces || buf->nb_colorranges || buf->nb_alphamodes) {
-#endif
if (buf->nb_pixel_formats) {
ret = ff_set_pixel_formats_from_list2(ctx, cfg_in, cfg_out, buf->pixel_formats);
if (ret < 0)
@@ -419,46 +319,6 @@ static int vsink_query_formats(const AVFilterContext *ctx,
if (ret < 0)
return ret;
}
-#if FF_API_BUFFERSINK_OPTS
- } else {
- unsigned i;
- if (buf->pixel_fmts_size) {
- AVFilterFormats *formats = NULL;
- for (i = 0; i < NB_ITEMS(buf->pixel_fmts); i++)
- if ((ret = ff_add_format(&formats, buf->pixel_fmts[i])) < 0)
- return ret;
- if ((ret = ff_set_common_formats2(ctx, cfg_in, cfg_out, formats)) < 0)
- return ret;
- }
-
- if (buf->color_spaces_size) {
- AVFilterFormats *formats = NULL;
- for (i = 0; i < NB_ITEMS(buf->color_spaces); i++)
- if ((ret = ff_add_format(&formats, buf->color_spaces[i])) < 0)
- return ret;
- if ((ret = ff_set_common_color_spaces2(ctx, cfg_in, cfg_out, formats)) < 0)
- return ret;
- }
-
- if (buf->color_ranges_size) {
- AVFilterFormats *formats = NULL;
- for (i = 0; i < NB_ITEMS(buf->color_ranges); i++)
- if ((ret = ff_add_format(&formats, buf->color_ranges[i])) < 0)
- return ret;
- if ((ret = ff_set_common_color_ranges2(ctx, cfg_in, cfg_out, formats)) < 0)
- return ret;
- }
-
- if (buf->alpha_modes_size) {
- AVFilterFormats *formats = NULL;
- for (i = 0; i < NB_ITEMS(buf->alpha_modes); i++)
- if ((ret = ff_add_format(&formats, buf->alpha_modes[i])) < 0)
- return ret;
- if ((ret = ff_set_common_alpha_modes2(ctx, cfg_in, cfg_out, formats)) < 0)
- return ret;
- }
- }
-#endif
return 0;
}
@@ -470,9 +330,6 @@ static int asink_query_formats(const AVFilterContext *ctx,
const BufferSinkContext *buf = ctx->priv;
int ret;
-#if FF_API_BUFFERSINK_OPTS
- if (buf->nb_sample_formats || buf->nb_samplerates || buf->nb_channel_layouts) {
-#endif
if (buf->nb_sample_formats) {
ret = ff_set_sample_formats_from_list2(ctx, cfg_in, cfg_out, buf->sample_formats);
if (ret < 0)
@@ -488,35 +345,6 @@ static int asink_query_formats(const AVFilterContext *ctx,
if (ret < 0)
return ret;
}
-#if FF_API_BUFFERSINK_OPTS
- } else {
- AVFilterFormats *formats = NULL;
- unsigned i;
-
- if (buf->sample_fmts_size) {
- for (i = 0; i < NB_ITEMS(buf->sample_fmts); i++)
- if ((ret = ff_add_format(&formats, buf->sample_fmts[i])) < 0)
- return ret;
- if ((ret = ff_set_common_formats2(ctx, cfg_in, cfg_out, formats)) < 0)
- return ret;
- }
-
- if (buf->nb_channel_layouts) {
- ret = ff_set_common_channel_layouts_from_list2(ctx, cfg_in, cfg_out, buf->channel_layouts);
- if (ret < 0)
- return ret;
- }
-
- if (buf->sample_rates_size) {
- formats = NULL;
- for (i = 0; i < NB_ITEMS(buf->sample_rates); i++)
- if ((ret = ff_add_format(&formats, buf->sample_rates[i])) < 0)
- return ret;
- if ((ret = ff_set_common_samplerates2(ctx, cfg_in, cfg_out, formats)) < 0)
- return ret;
- }
- }
-#endif
return 0;
}
@@ -524,12 +352,6 @@ static int asink_query_formats(const AVFilterContext *ctx,
#define OFFSET(x) offsetof(BufferSinkContext, x)
#define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
static const AVOption buffersink_options[] = {
-#if FF_API_BUFFERSINK_OPTS
- { "pix_fmts", "set the supported pixel formats", OFFSET(pixel_fmts), AV_OPT_TYPE_BINARY, .flags = FLAGS | AV_OPT_FLAG_DEPRECATED },
- { "color_spaces", "set the supported color spaces", OFFSET(color_spaces), AV_OPT_TYPE_BINARY, .flags = FLAGS | AV_OPT_FLAG_DEPRECATED },
- { "color_ranges", "set the supported color ranges", OFFSET(color_ranges), AV_OPT_TYPE_BINARY, .flags = FLAGS | AV_OPT_FLAG_DEPRECATED },
-#endif
-
{ "pixel_formats", "array of supported pixel formats", OFFSET(pixel_formats),
AV_OPT_TYPE_PIXEL_FMT | AV_OPT_TYPE_FLAG_ARRAY, .max = INT_MAX, .flags = FLAGS },
{ "colorspaces", "array of supported color spaces", OFFSET(colorspaces),
@@ -544,14 +366,6 @@ static const AVOption buffersink_options[] = {
#undef FLAGS
#define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_AUDIO_PARAM
static const AVOption abuffersink_options[] = {
-#if FF_API_BUFFERSINK_OPTS
- { "sample_fmts", "set the supported sample formats", OFFSET(sample_fmts), AV_OPT_TYPE_BINARY, .flags = FLAGS | AV_OPT_FLAG_DEPRECATED },
- { "sample_rates", "set the supported sample rates", OFFSET(sample_rates), AV_OPT_TYPE_BINARY, .flags = FLAGS | AV_OPT_FLAG_DEPRECATED },
- { "ch_layouts", "set a '|'-separated list of supported channel layouts",
- OFFSET(channel_layouts_str), AV_OPT_TYPE_STRING, .flags = FLAGS | AV_OPT_FLAG_DEPRECATED },
- { "all_channel_counts", "accept all channel counts", OFFSET(all_channel_counts), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, FLAGS | AV_OPT_FLAG_DEPRECATED },
-#endif
-
{ "sample_formats", "array of supported sample formats", OFFSET(sample_formats),
AV_OPT_TYPE_SAMPLE_FMT | AV_OPT_TYPE_FLAG_ARRAY, .max = INT_MAX, .flags = FLAGS },
{ "samplerates", "array of supported sample formats", OFFSET(samplerates),
diff --git a/libavfilter/version_major.h b/libavfilter/version_major.h
index 539d5caa3d..ee7ac75212 100644
--- a/libavfilter/version_major.h
+++ b/libavfilter/version_major.h
@@ -35,7 +35,6 @@
* the public API and may change, break or disappear at any time.
*/
-#define FF_API_BUFFERSINK_OPTS (LIBAVFILTER_VERSION_MAJOR < 12)
#define FF_API_CONTEXT_PUBLIC (LIBAVFILTER_VERSION_MAJOR < 12)
#define FF_API_LIBNPP_SUPPORT (LIBAVFILTER_VERSION_MAJOR < 12)
--
2.52.0
From 7a2715636760c286040c4dcae99c028cbe4d6a0f Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
Date: Sun, 8 Mar 2026 19:52:03 +0100
Subject: [PATCH 03/33] avfilter/avfilter: Remove FF_API_CONTEXT_PUBLIC
Deprecated on 2024-10-07.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
---
libavfilter/avfilter.h | 28 ----------------------------
libavfilter/version_major.h | 1 -
2 files changed, 29 deletions(-)
diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h
index 02b58c42c2..1363a861a1 100644
--- a/libavfilter/avfilter.h
+++ b/libavfilter/avfilter.h
@@ -37,7 +37,6 @@
#include <stddef.h>
-#include "libavutil/attributes.h"
#include "libavutil/avutil.h"
#include "libavutil/buffer.h"
#include "libavutil/dict.h"
@@ -315,26 +314,7 @@ typedef struct AVFilterContext {
*/
int nb_threads;
-#if FF_API_CONTEXT_PUBLIC
- /**
- * @deprecated unused
- */
- attribute_deprecated
- struct AVFilterCommand *command_queue;
-#endif
-
char *enable_str; ///< enable expression string
-#if FF_API_CONTEXT_PUBLIC
- /**
- * @deprecated unused
- */
- attribute_deprecated
- void *enable;
- /**
- * @deprecated unused
- */
- double *var_values;
-#endif
/**
* MUST NOT be accessed from outside avfilter.
*
@@ -355,14 +335,6 @@ typedef struct AVFilterContext {
*/
AVBufferRef *hw_device_ctx;
-#if FF_API_CONTEXT_PUBLIC
- /**
- * @deprecated this field should never have been accessed by callers
- */
- attribute_deprecated
- unsigned ready;
-#endif
-
/**
* Sets the number of extra hardware frames which the filter will
* allocate on its output links for use in following filters or by
diff --git a/libavfilter/version_major.h b/libavfilter/version_major.h
index ee7ac75212..1535982260 100644
--- a/libavfilter/version_major.h
+++ b/libavfilter/version_major.h
@@ -35,7 +35,6 @@
* the public API and may change, break or disappear at any time.
*/
-#define FF_API_CONTEXT_PUBLIC (LIBAVFILTER_VERSION_MAJOR < 12)
#define FF_API_LIBNPP_SUPPORT (LIBAVFILTER_VERSION_MAJOR < 12)
#endif /* AVFILTER_VERSION_MAJOR_H */
--
2.52.0
From eb74e890b16ad0151dc8060d18b00f8870450514 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
Date: Wed, 11 Mar 2026 08:35:27 +0100
Subject: [PATCH 04/33] avfilter: Remove FF_API_LIBNPP_SUPPORT
libnpp and the corresponding filters have been deprecated
in commit 994a368451b37b97ed2ff76354fd97d5c6a0fff2
on 2025-09-26. By the time of our next release,
a year will have passed, so they are removed immediately.
Note: Passing --enable-libnpp to configure results in
a warning about the deprecation and is otherwise a no-op.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
---
configure | 16 +-
doc/filters.texi | 328 ++--------------------
libavfilter/Makefile | 4 -
libavfilter/allfilters.c | 4 -
libavfilter/version_major.h | 2 -
libavfilter/vf_sharpen_npp.c | 277 -------------------
libavfilter/vf_transpose_npp.c | 482 ---------------------------------
7 files changed, 31 insertions(+), 1082 deletions(-)
delete mode 100644 libavfilter/vf_sharpen_npp.c
delete mode 100644 libavfilter/vf_transpose_npp.c
diff --git a/configure b/configure
index a6bbb86807..dc732587cc 100755
--- a/configure
+++ b/configure
@@ -360,7 +360,6 @@ External library support:
--disable-libdrm disable DRM code (Linux) [autodetect]
--enable-libmfx enable Intel MediaSDK (AKA Quick Sync Video) code via libmfx [no]
--enable-libvpl enable Intel oneVPL code via libvpl if libmfx is not used [no]
- --enable-libnpp enable Nvidia Performance Primitives-based code [no]
--enable-mmal enable Broadcom Multi-Media Abstraction Layer (Raspberry Pi) via MMAL [no]
--disable-nvdec disable Nvidia video decoding acceleration (via hwaccel) [autodetect]
--disable-nvenc disable Nvidia video encoding code [autodetect]
@@ -2197,7 +2196,6 @@ EXTRALIBS_LIST="
HWACCEL_LIBRARY_NONFREE_LIST="
cuda_nvcc
cuda_sdk
- libnpp
"
HWACCEL_LIBRARY_LIST="
@@ -2872,6 +2870,7 @@ CMDLINE_SELECT="
cross_compile
debug
extra_warnings
+ libnpp
logging
optimizations
response_files
@@ -3586,20 +3585,16 @@ chromakey_cuda_filter_deps_any="cuda_nvcc cuda_llvm"
colorspace_cuda_filter_deps="ffnvcodec"
colorspace_cuda_filter_deps_any="cuda_nvcc cuda_llvm"
hwupload_cuda_filter_deps="ffnvcodec"
-scale_npp_filter_deps="ffnvcodec libnpp"
-scale2ref_npp_filter_deps="ffnvcodec libnpp"
scale_cuda_filter_deps="ffnvcodec"
scale_cuda_filter_deps_any="cuda_nvcc cuda_llvm"
thumbnail_cuda_filter_deps="ffnvcodec"
thumbnail_cuda_filter_deps_any="cuda_nvcc cuda_llvm"
transpose_cuda_filter_deps="ffnvcodec"
transpose_cuda_filter_deps_any="cuda_nvcc cuda_llvm"
-transpose_npp_filter_deps="ffnvcodec libnpp"
overlay_cuda_filter_deps="ffnvcodec"
overlay_cuda_filter_deps_any="cuda_nvcc cuda_llvm"
pad_cuda_filter_deps="ffnvcodec"
pad_cuda_filter_deps_any="cuda_nvcc cuda_llvm"
-sharpen_npp_filter_deps="ffnvcodec libnpp"
ddagrab_filter_deps="d3d11va IDXGIOutput1 DXGI_OUTDUPL_FRAME_INFO"
gfxcapture_filter_deps="cxx17 threads d3d11va IGraphicsCaptureItemInterop __x_ABI_CWindows_CGraphics_CCapture_CIGraphicsCaptureSession3"
@@ -4801,6 +4796,8 @@ for opt do
esac
done
+enabled libnpp && warn "libnpp has been removed and enabling it does nothing."
+
for e in $env; do
eval "export $e"
done
@@ -7433,13 +7430,6 @@ enabled libmp3lame && require "libmp3lame >= 3.98.3" lame/lame.h lame_set
enabled libmpeghdec && require_pkg_config libmpeghdec "mpeghdec >= 3.0.0" mpeghdec/mpeghdecoder.h mpeghdecoder_init
enabled libmysofa && { check_pkg_config libmysofa libmysofa mysofa.h mysofa_neighborhood_init_withstepdefine ||
require libmysofa mysofa.h mysofa_neighborhood_init_withstepdefine -lmysofa $zlib_extralibs; }
-enabled libnpp && { test_cpp_condition "$(cd "$source_path"; pwd)/libavfilter/version_major.h" FF_API_LIBNPP_SUPPORT ||
- die "ERROR: libnpp support is removed in this version"; } &&
- { check_lib libnpp npp.h nppGetLibVersion -lnppig -lnppicc -lnppc -lnppidei -lnppif ||
- check_lib libnpp npp.h nppGetLibVersion -lnppi -lnppif -lnppc -lnppidei ||
- die "ERROR: libnpp not found"; } &&
- { check_func_headers "nppi.h" nppiYCbCr420_8u_P2P3R $libnpp_extralibs ||
- die "ERROR: libnpp support is deprecated, version 13.0 and up are not supported"; }
enabled libopencore_amrnb && { check_pkg_config libopencore_amrnb opencore-amrnb opencore-amrnb/interf_dec.h Decoder_Interface_init ||
require libopencore_amrnb opencore-amrnb/interf_dec.h Decoder_Interface_init -lopencore-amrnb; }
enabled libopencore_amrwb && { check_pkg_config libopencore_amrwb opencore-amrwb opencore-amrwb/dec_if.h D_IF_init ||
diff --git a/doc/filters.texi b/doc/filters.texi
index 2cae41c7c5..8cd4df3f31 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -27057,7 +27057,19 @@ value.
@chapter CUDA Video Filters
@c man begin CUDA Video Filters
-To enable CUDA and/or NPP filters please refer to configuration guidelines for @ref{CUDA} and for @ref{CUDA NPP} filters.
+Below is a description of the currently available Nvidia CUDA video filters.
+
+Prerequisites:
+@itemize
+@item Install Nvidia CUDA Toolkit
+@end itemize
+
+Note: If FFmpeg detects the Nvidia CUDA Toolkit during configuration, it will enable CUDA filters automatically without requiring any additional flags. If you want to explicitly enable them, use the following options:
+
+@itemize
+@item Configure FFmpeg with @code{--enable-cuda-nvcc --enable-nonfree}.
+@item Configure FFmpeg with @code{--enable-cuda-llvm}. Additional requirement: @code{llvm} lib must be installed.
+@end itemize
Running CUDA filters requires you to initialize a hardware device and to pass that device to all filters in any filter graph.
@table @option
@@ -27092,23 +27104,7 @@ Since CUDA filters operate exclusively on GPU memory, frame data must sometimes
@end itemize
Note that @ref{hwupload} uploads data to a surface with the same layout as the software frame, so it may be necessary to add a @ref{format} filter immediately before @ref{hwupload} to ensure the input is in the correct format. Similarly, @ref{hwdownload} may not support all output formats, so an additional @ref{format} filter may need to be inserted immediately after @ref{hwdownload} in the filter graph to ensure compatibility.
-@anchor{CUDA}
-@section CUDA
-Below is a description of the currently available Nvidia CUDA video filters.
-
-Prerequisites:
-@itemize
-@item Install Nvidia CUDA Toolkit
-@end itemize
-
-Note: If FFmpeg detects the Nvidia CUDA Toolkit during configuration, it will enable CUDA filters automatically without requiring any additional flags. If you want to explicitly enable them, use the following options:
-
-@itemize
-@item Configure FFmpeg with @code{--enable-cuda-nvcc --enable-nonfree}.
-@item Configure FFmpeg with @code{--enable-cuda-llvm}. Additional requirement: @code{llvm} lib must be installed.
-@end itemize
-
-@subsection bilateral_cuda
+@section bilateral_cuda
CUDA accelerated bilateral filter, an edge preserving filter.
This filter is mathematically accurate thanks to the use of GPU acceleration.
For best output quality, use one to one chroma subsampling, i.e. yuv444p format.
@@ -27128,7 +27124,7 @@ Set window size of the bilateral function to determine the number of neighbours
If the number entered is even, one will be added automatically.
Allowed range is 1 to 255. Default is 1.
@end table
-@subsubsection Examples
+@subsection Examples
@itemize
@item
@@ -27147,7 +27143,7 @@ Apply the bilateral filter on a video.
@end itemize
-@subsection bwdif_cuda
+@section bwdif_cuda
Deinterlace the input video using the @ref{bwdif} algorithm, but implemented
in CUDA so that it can work as part of a GPU accelerated pipeline with nvdec
@@ -27199,13 +27195,13 @@ Only deinterlace frames marked as interlaced.
The default value is @code{all}.
@end table
-@subsection chromakey_cuda
+@section chromakey_cuda
CUDA accelerated YUV colorspace color/chroma keying.
This filter works like normal chromakey filter but operates on CUDA frames.
for more details and parameters see @ref{chromakey}.
-@subsubsection Examples
+@subsection Examples
@itemize
@item
@@ -27241,7 +27237,7 @@ Process two software sources, explicitly uploading the frames:
@end itemize
-@subsection colorspace_cuda
+@section colorspace_cuda
CUDA accelerated implementation of the colorspace filter.
@@ -27274,7 +27270,7 @@ JPEG (full) range
@end table
@anchor{overlay_cuda}
-@subsection overlay_cuda
+@section overlay_cuda
Overlay one video on top of another.
@@ -27353,13 +27349,13 @@ This filter also supports the @ref{framesync} options.
@anchor{pad_cuda}
-@subsection pad_cuda
+@section pad_cuda
Add paddings to an input video stream using CUDA.
This filter is the CUDA-accelerated version of the @ref{pad} filter. It accepts the same options and expressions and provides the same core functionality.
For a detailed description of available options, please see the documentation for the @ref{pad} filter.
-@subsubsection Examples
+@subsection Examples
@itemize
@item
@@ -27376,7 +27372,7 @@ ffmpeg -hwaccel cuda -hwaccel_output_format cuda -i input.mp4 -vf "pad_cuda=w=ih
@end itemize
@anchor{scale_cuda}
-@subsection scale_cuda
+@section scale_cuda
Scale (resize) and convert (pixel format) the input video, using accelerated CUDA kernels.
Setting the output width and height works in the same way as for the @ref{scale} filter.
@@ -27439,7 +27435,7 @@ Works the same as the identical @ref{scale} filter option.
@end table
-@subsubsection Examples
+@subsection Examples
@itemize
@item
@@ -27463,7 +27459,7 @@ scale_cuda=passthrough=0
@end example
@end itemize
-@subsection thumbnail_cuda
+@section thumbnail_cuda
Select the most representative frame in a given sequence of consecutive frames using CUDA.
@@ -27479,7 +27475,7 @@ the end. Default is @code{100}.
Since the filter keeps track of the whole frames sequence, a bigger @var{n}
value will result in a higher memory usage, so a high value is not recommended.
-@subsubsection Example
+@subsection Example
@itemize
@@ -27491,7 +27487,7 @@ Thumbnails are extracted from every @var{n}=150-frame batch, selecting one per b
@end itemize
-@subsection transpose_cuda
+@section transpose_cuda
Transpose rows with columns in the input video and optionally flip it.
For more in depth examples see the @ref{transpose} video filter, which shares mostly the same options.
@@ -27541,7 +27537,7 @@ Preserve landscape geometry (when @var{width} >= @var{height}).
@end table
-@subsection yadif_cuda
+@section yadif_cuda
Deinterlace the input video using the @ref{yadif} algorithm, but implemented
in CUDA so that it can work as part of a GPU accelerated pipeline with nvdec
@@ -27599,274 +27595,6 @@ Only deinterlace frames marked as interlaced.
The default value is @code{all}.
@end table
-@anchor{CUDA NPP}
-@section CUDA NPP
-Below is a description of the currently available NVIDIA Performance Primitives (libnpp) video filters.
-
-Prerequisites:
-@itemize
-@item Install Nvidia CUDA Toolkit
-@item Install libnpp
-@end itemize
-
-To enable CUDA NPP filters:
-
-@itemize
-@item Configure FFmpeg with @code{--enable-nonfree --enable-libnpp}.
-@end itemize
-
-
-@anchor{scale_npp}
-@subsection scale_npp
-
-Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
-format conversion on CUDA video frames. Setting the output width and height
-works in the same way as for the @var{scale} filter.
-
-The following additional options are accepted:
-@table @option
-@item format
-The pixel format of the output CUDA frames. If set to the string "same" (the
-default), the input format will be kept. Note that automatic format negotiation
-and conversion is not yet supported for hardware frames
-
-@item interp_algo
-The interpolation algorithm used for resizing. One of the following:
-@table @option
-@item nn
-Nearest neighbour.
-
-@item linear
-@item cubic
-@item cubic2p_bspline
-2-parameter cubic (B=1, C=0)
-
-@item cubic2p_catmullrom
-2-parameter cubic (B=0, C=1/2)
-
-@item cubic2p_b05c03
-2-parameter cubic (B=1/2, C=3/10)
-
-@item super
-Supersampling
-
-@item lanczos
-@end table
-
-@item force_original_aspect_ratio
-Enable decreasing or increasing output video width or height if necessary to
-keep the original aspect ratio. Possible values:
-
-@table @samp
-@item disable
-Scale the video as specified and disable this feature.
-
-@item decrease
-The output video dimensions will automatically be decreased if needed.
-
-@item increase
-The output video dimensions will automatically be increased if needed.
-
-@end table
-
-One useful instance of this option is that when you know a specific device's
-maximum allowed resolution, you can use this to limit the output video to
-that, while retaining the aspect ratio. For example, device A allows
-1280x720 playback, and your video is 1920x800. Using this option (set it to
-decrease) and specifying 1280x720 to the command line makes the output
-1280x533.
-
-Please note that this is a different thing than specifying -1 for @option{w}
-or @option{h}, you still need to specify the output resolution for this option
-to work.
-
-@item force_divisible_by
-Ensures that both the output dimensions, width and height, are divisible by the
-given integer when used together with @option{force_original_aspect_ratio}. This
-works similar to using @code{-n} in the @option{w} and @option{h} options.
-
-This option respects the value set for @option{force_original_aspect_ratio},
-increasing or decreasing the resolution accordingly. The video's aspect ratio
-may be slightly modified.
-
-This option can be handy if you need to have a video fit within or exceed
-a defined resolution using @option{force_original_aspect_ratio} but also have
-encoder restrictions on width or height divisibility.
-
-@item reset_sar
-Works the same as the identical @ref{scale} filter option.
-
-@item eval
-Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
-
-@table @samp
-@item init
-Only evaluate expressions once during the filter initialization or when a command is processed.
-
-@item frame
-Evaluate expressions for each incoming frame.
-
-@end table
-
-@end table
-
-The values of the @option{w} and @option{h} options are expressions
-containing the following constants:
-
-@table @var
-@item in_w
-@item in_h
-The input width and height
-
-@item iw
-@item ih
-These are the same as @var{in_w} and @var{in_h}.
-
-@item out_w
-@item out_h
-The output (scaled) width and height
-
-@item ow
-@item oh
-These are the same as @var{out_w} and @var{out_h}
-
-@item a
-The same as @var{iw} / @var{ih}
-
-@item sar
-input sample aspect ratio
-
-@item dar
-The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
-
-@item n
-The (sequential) number of the input frame, starting from 0.
-Only available with @code{eval=frame}.
-
-@item t
-The presentation timestamp of the input frame, expressed as a number of
-seconds. Only available with @code{eval=frame}.
-
-@item pos
-The position (byte offset) of the frame in the input stream, or NaN if
-this information is unavailable and/or meaningless (for example in case of synthetic video).
-Only available with @code{eval=frame}.
-Deprecated, do not use.
-@end table
-
-@subsection scale2ref_npp
-
-Use the NVIDIA Performance Primitives (libnpp) to scale (resize) the input
-video, based on a reference video.
-
-See the @ref{scale_npp} filter for available options, scale2ref_npp supports the same
-but uses the reference video instead of the main input as basis. scale2ref_npp
-also supports the following additional constants for the @option{w} and
-@option{h} options:
-
-@table @var
-@item main_w
-@item main_h
-The main input video's width and height
-
-@item main_a
-The same as @var{main_w} / @var{main_h}
-
-@item main_sar
-The main input video's sample aspect ratio
-
-@item main_dar, mdar
-The main input video's display aspect ratio. Calculated from
-@code{(main_w / main_h) * main_sar}.
-
-@item main_n
-The (sequential) number of the main input frame, starting from 0.
-Only available with @code{eval=frame}.
-
-@item main_t
-The presentation timestamp of the main input frame, expressed as a number of
-seconds. Only available with @code{eval=frame}.
-
-@item main_pos
-The position (byte offset) of the frame in the main input stream, or NaN if
-this information is unavailable and/or meaningless (for example in case of synthetic video).
-Only available with @code{eval=frame}.
-@end table
-
-@subsubsection Examples
-
-@itemize
-@item
-Scale a subtitle stream (b) to match the main video (a) in size before overlaying
-@example
-'scale2ref_npp[b][a];[a][b]overlay_cuda'
-@end example
-
-@item
-Scale a logo to 1/10th the height of a video, while preserving its display aspect ratio.
-@example
-[logo-in][video-in]scale2ref_npp=w=oh*mdar:h=ih/10[logo-out][video-out]
-@end example
-@end itemize
-
-@subsection sharpen_npp
-Use the NVIDIA Performance Primitives (libnpp) to perform image sharpening with
-border control.
-
-The following additional options are accepted:
-@table @option
-
-@item border_type
-Type of sampling to be used ad frame borders. One of the following:
-@table @option
-
-@item replicate
-Replicate pixel values.
-
-@end table
-@end table
-
-@subsection transpose_npp
-
-Transpose rows with columns in the input video and optionally flip it.
-For more in depth examples see the @ref{transpose} video filter, which shares mostly the same options.
-
-It accepts the following parameters:
-
-@table @option
-
-@item dir
-Specify the transposition direction.
-
-Can assume the following values:
-@table @samp
-@item cclock_flip
-Rotate by 90 degrees counterclockwise and vertically flip. (default)
-
-@item clock
-Rotate by 90 degrees clockwise.
-
-@item cclock
-Rotate by 90 degrees counterclockwise.
-
-@item clock_flip
-Rotate by 90 degrees clockwise and vertically flip.
-@end table
-
-@item passthrough
-Do not apply the transposition if the input geometry matches the one
-specified by the specified value. It accepts the following values:
-@table @samp
-@item none
-Always apply transposition. (default)
-@item portrait
-Preserve portrait geometry (when @var{height} >= @var{width}).
-@item landscape
-Preserve landscape geometry (when @var{width} >= @var{height}).
-@end table
-
-@end table
-
@c man end CUDA Video Filters
@chapter OpenCL Video Filters
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index 5f0760a2ff..364235a708 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -475,13 +475,11 @@ OBJS-$(CONFIG_SCALE_D3D11_FILTER) += vf_scale_d3d11.o scale_eval.o
OBJS-$(CONFIG_SCALE_D3D12_FILTER) += vf_scale_d3d12.o scale_eval.o
OBJS-$(CONFIG_SCALE_CUDA_FILTER) += vf_scale_cuda.o scale_eval.o \
vf_scale_cuda.ptx.o cuda/load_helper.o
-OBJS-$(CONFIG_SCALE_NPP_FILTER) += vf_scale_npp.o scale_eval.o
OBJS-$(CONFIG_SCALE_QSV_FILTER) += vf_vpp_qsv.o
OBJS-$(CONFIG_SCALE_VAAPI_FILTER) += vf_scale_vaapi.o scale_eval.o vaapi_vpp.o
OBJS-$(CONFIG_SCALE_VT_FILTER) += vf_scale_vt.o scale_eval.o
OBJS-$(CONFIG_SCALE_VULKAN_FILTER) += vf_scale_vulkan.o vulkan.o vulkan_filter.o
OBJS-$(CONFIG_SCALE2REF_FILTER) += vf_scale.o scale_eval.o framesync.o
-OBJS-$(CONFIG_SCALE2REF_NPP_FILTER) += vf_scale_npp.o scale_eval.o
OBJS-$(CONFIG_SCDET_FILTER) += vf_scdet.o
OBJS-$(CONFIG_SCDET_VULKAN_FILTER) += vf_scdet_vulkan.o
OBJS-$(CONFIG_SCHARR_FILTER) += vf_convolution.o
@@ -498,7 +496,6 @@ OBJS-$(CONFIG_SETPTS_FILTER) += setpts.o
OBJS-$(CONFIG_SETRANGE_FILTER) += vf_setparams.o
OBJS-$(CONFIG_SETSAR_FILTER) += vf_aspect.o
OBJS-$(CONFIG_SETTB_FILTER) += settb.o
-OBJS-$(CONFIG_SHARPEN_NPP_FILTER) += vf_sharpen_npp.o
OBJS-$(CONFIG_SHARPNESS_VAAPI_FILTER) += vf_misc_vaapi.o vaapi_vpp.o
OBJS-$(CONFIG_SHEAR_FILTER) += vf_shear.o
OBJS-$(CONFIG_SHOWINFO_FILTER) += vf_showinfo.o
@@ -548,7 +545,6 @@ OBJS-$(CONFIG_TPAD_FILTER) += vf_tpad.o
OBJS-$(CONFIG_TRANSPOSE_FILTER) += vf_transpose.o
OBJS-$(CONFIG_TRANSPOSE_CUDA_FILTER) += vf_transpose_cuda.o vf_transpose_cuda.ptx.o \
cuda/load_helper.o
-OBJS-$(CONFIG_TRANSPOSE_NPP_FILTER) += vf_transpose_npp.o
OBJS-$(CONFIG_TRANSPOSE_OPENCL_FILTER) += vf_transpose_opencl.o opencl.o opencl/transpose.o
OBJS-$(CONFIG_TRANSPOSE_VAAPI_FILTER) += vf_transpose_vaapi.o vaapi_vpp.o
OBJS-$(CONFIG_TRANSPOSE_VT_FILTER) += vf_transpose_vt.o
diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
index 66c49d453b..402b843649 100644
--- a/libavfilter/allfilters.c
+++ b/libavfilter/allfilters.c
@@ -447,13 +447,11 @@ extern const FFFilter ff_vf_frc_amf;
extern const FFFilter ff_vf_scale_cuda;
extern const FFFilter ff_vf_scale_d3d11;
extern const FFFilter ff_vf_scale_d3d12;
-extern const FFFilter ff_vf_scale_npp;
extern const FFFilter ff_vf_scale_qsv;
extern const FFFilter ff_vf_scale_vaapi;
extern const FFFilter ff_vf_scale_vt;
extern const FFFilter ff_vf_scale_vulkan;
extern const FFFilter ff_vf_scale2ref;
-extern const FFFilter ff_vf_scale2ref_npp;
extern const FFFilter ff_vf_scdet;
extern const FFFilter ff_vf_scdet_vulkan;
extern const FFFilter ff_vf_scharr;
@@ -470,7 +468,6 @@ extern const FFFilter ff_vf_setpts;
extern const FFFilter ff_vf_setrange;
extern const FFFilter ff_vf_setsar;
extern const FFFilter ff_vf_settb;
-extern const FFFilter ff_vf_sharpen_npp;
extern const FFFilter ff_vf_sharpness_vaapi;
extern const FFFilter ff_vf_shear;
extern const FFFilter ff_vf_showinfo;
@@ -515,7 +512,6 @@ extern const FFFilter ff_vf_tonemap_vaapi;
extern const FFFilter ff_vf_tpad;
extern const FFFilter ff_vf_transpose;
extern const FFFilter ff_vf_transpose_cuda;
-extern const FFFilter ff_vf_transpose_npp;
extern const FFFilter ff_vf_transpose_opencl;
extern const FFFilter ff_vf_transpose_vaapi;
extern const FFFilter ff_vf_transpose_vt;
diff --git a/libavfilter/version_major.h b/libavfilter/version_major.h
index 1535982260..4db5978d3b 100644
--- a/libavfilter/version_major.h
+++ b/libavfilter/version_major.h
@@ -35,6 +35,4 @@
* the public API and may change, break or disappear at any time.
*/
-#define FF_API_LIBNPP_SUPPORT (LIBAVFILTER_VERSION_MAJOR < 12)
-
#endif /* AVFILTER_VERSION_MAJOR_H */
diff --git a/libavfilter/vf_sharpen_npp.c b/libavfilter/vf_sharpen_npp.c
deleted file mode 100644
index 3ec74f8c0c..0000000000
--- a/libavfilter/vf_sharpen_npp.c
+++ /dev/null
@@ -1,277 +0,0 @@
-/*
- * 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
- */
-
-/**
- * @file
- * NPP sharpen video filter
- */
-
-#include <nppi.h>
-#include <nppi_filtering_functions.h>
-
-#include "filters.h"
-#include "libavutil/pixdesc.h"
-#include "libavutil/cuda_check.h"
-#include "libavutil/hwcontext.h"
-#include "libavutil/hwcontext_cuda_internal.h"
-#include "libavutil/opt.h"
-
-
-#define CHECK_CU(x) FF_CUDA_CHECK_DL(ctx, device_hwctx->internal->cuda_dl, x)
-
-static const enum AVPixelFormat supported_formats[] = {
- AV_PIX_FMT_YUV420P,
- AV_PIX_FMT_YUV444P,
-};
-
-typedef struct NPPSharpenContext {
- const AVClass* class;
-
- AVBufferRef* frames_ctx;
- AVFrame* own_frame;
- AVFrame* tmp_frame;
-
- NppiBorderType border_type;
-} NPPSharpenContext;
-
-static int nppsharpen_init(AVFilterContext* ctx)
-{
- NPPSharpenContext* s = ctx->priv;
-
- av_log(ctx, AV_LOG_WARNING, "The libnpp based filters are deprecated.\n");
-
- s->own_frame = av_frame_alloc();
- if (!s->own_frame)
- goto fail;
-
- s->tmp_frame = av_frame_alloc();
- if (!s->tmp_frame)
- goto fail;
-
- return 0;
-
-fail:
- av_frame_free(&s->own_frame);
- av_frame_free(&s->tmp_frame);
- return AVERROR(ENOMEM);
-}
-
-static int nppsharpen_config(AVFilterContext* ctx, int width, int height)
-{
- FilterLink *inl = ff_filter_link(ctx->inputs[0]);
- FilterLink *outl = ff_filter_link(ctx->outputs[0]);
- NPPSharpenContext* s = ctx->priv;
- AVHWFramesContext *out_ctx, *in_ctx;
- int i, ret, supported_format = 0;
-
- if (!inl->hw_frames_ctx) {
- av_log(ctx, AV_LOG_ERROR, "No hw context provided on input\n");
- goto fail;
- }
-
- in_ctx = (AVHWFramesContext*)inl->hw_frames_ctx->data;
-
- s->frames_ctx = av_hwframe_ctx_alloc(in_ctx->device_ref);
- if (!s->frames_ctx)
- goto fail;
-
- out_ctx = (AVHWFramesContext*)s->frames_ctx->data;
- out_ctx->format = AV_PIX_FMT_CUDA;
- out_ctx->sw_format = in_ctx->sw_format;
- out_ctx->width = FFALIGN(width, 32);
- out_ctx->height = FFALIGN(height, 32);
-
- for (i = 0; i < FF_ARRAY_ELEMS(supported_formats); i++) {
- if (in_ctx->sw_format == supported_formats[i]) {
- supported_format = 1;
- break;
- }
- }
-
- if (!supported_format) {
- av_log(ctx, AV_LOG_ERROR, "Unsupported pixel format\n");
- goto fail;
- }
-
- ret = av_hwframe_ctx_init(s->frames_ctx);
- if (ret < 0)
- goto fail;
-
- ret = av_hwframe_get_buffer(s->frames_ctx, s->own_frame, 0);
- if (ret < 0)
- goto fail;
-
- outl->hw_frames_ctx = av_buffer_ref(s->frames_ctx);
- if (!outl->hw_frames_ctx)
- goto fail;
-
- return 0;
-
-fail:
- av_buffer_unref(&s->frames_ctx);
- return AVERROR(ENOMEM);
-}
-
-static void nppsharpen_uninit(AVFilterContext* ctx)
-{
- NPPSharpenContext* s = ctx->priv;
-
- av_buffer_unref(&s->frames_ctx);
- av_frame_free(&s->own_frame);
- av_frame_free(&s->tmp_frame);
-}
-
-static int nppsharpen_config_props(AVFilterLink* outlink)
-{
- AVFilterLink* inlink = outlink->src->inputs[0];
-
- outlink->w = inlink->w;
- outlink->h = inlink->h;
-
- if (inlink->sample_aspect_ratio.num)
- outlink->sample_aspect_ratio = av_mul_q(
- (AVRational){outlink->h * inlink->w, outlink->w * inlink->h},
- inlink->sample_aspect_ratio);
- else
- outlink->sample_aspect_ratio = inlink->sample_aspect_ratio;
-
- nppsharpen_config(outlink->src, inlink->w, inlink->h);
-
- return 0;
-}
-
-static int nppsharpen_sharpen(AVFilterContext* ctx, AVFrame* out, AVFrame* in)
-{
- FilterLink *inl = ff_filter_link(ctx->inputs[0]);
- AVHWFramesContext* in_ctx = (AVHWFramesContext*)inl->hw_frames_ctx->data;
- NPPSharpenContext* s = ctx->priv;
-
- const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(in_ctx->sw_format);
-
- for (int i = 0; i < FF_ARRAY_ELEMS(in->data) && in->data[i]; i++) {
- int ow = AV_CEIL_RSHIFT(in->width, (i == 1 || i == 2) ? desc->log2_chroma_w : 0);
- int oh = AV_CEIL_RSHIFT(in->height, (i == 1 || i == 2) ? desc->log2_chroma_h : 0);
-
- NppStatus err = nppiFilterSharpenBorder_8u_C1R(
- in->data[i], in->linesize[i], (NppiSize){ow, oh}, (NppiPoint){0, 0},
- out->data[i], out->linesize[i], (NppiSize){ow, oh}, s->border_type);
- if (err != NPP_SUCCESS) {
- av_log(ctx, AV_LOG_ERROR, "NPP sharpen error: %d\n", err);
- return AVERROR_EXTERNAL;
- }
- }
-
- return 0;
-}
-
-static int nppsharpen_filter_frame(AVFilterLink* link, AVFrame* in)
-{
- AVFilterContext* ctx = link->dst;
- NPPSharpenContext* s = ctx->priv;
- AVFilterLink* outlink = ctx->outputs[0];
- FilterLink *outl = ff_filter_link(outlink);
- AVHWFramesContext* frames_ctx =
- (AVHWFramesContext*)outl->hw_frames_ctx->data;
- AVCUDADeviceContext* device_hwctx = frames_ctx->device_ctx->hwctx;
-
- AVFrame* out = NULL;
- CUcontext dummy;
- int ret = 0;
-
- out = av_frame_alloc();
- if (!out) {
- ret = AVERROR(ENOMEM);
- goto fail;
- }
-
- ret = CHECK_CU(device_hwctx->internal->cuda_dl->cuCtxPushCurrent(
- device_hwctx->cuda_ctx));
- if (ret < 0)
- goto fail;
-
- ret = nppsharpen_sharpen(ctx, s->own_frame, in);
- if (ret < 0)
- goto pop_ctx;
-
- ret = av_hwframe_get_buffer(s->own_frame->hw_frames_ctx, s->tmp_frame, 0);
- if (ret < 0)
- goto pop_ctx;
-
- av_frame_move_ref(out, s->own_frame);
- av_frame_move_ref(s->own_frame, s->tmp_frame);
-
- ret = av_frame_copy_props(out, in);
- if (ret < 0)
- goto pop_ctx;
-
- av_frame_free(&in);
-
-pop_ctx:
- CHECK_CU(device_hwctx->internal->cuda_dl->cuCtxPopCurrent(&dummy));
- if (!ret)
- return ff_filter_frame(outlink, out);
-fail:
- av_frame_free(&in);
- av_frame_free(&out);
- return ret;
-}
-
-#define OFFSET(x) offsetof(NPPSharpenContext, x)
-#define FLAGS (AV_OPT_FLAG_FILTERING_PARAM | AV_OPT_FLAG_VIDEO_PARAM)
-static const AVOption options[] = {
- { "border_type", "Type of operation to be performed on image border", OFFSET(border_type), AV_OPT_TYPE_INT, { .i64 = NPP_BORDER_REPLICATE }, NPP_BORDER_REPLICATE, NPP_BORDER_REPLICATE, FLAGS, .unit = "border_type" },
- { "replicate", "replicate pixels", 0, AV_OPT_TYPE_CONST, { .i64 = NPP_BORDER_REPLICATE }, 0, 0, FLAGS, .unit = "border_type" },
- {NULL},
-};
-
-static const AVClass nppsharpen_class = {
- .class_name = "nppsharpen",
- .item_name = av_default_item_name,
- .option = options,
- .version = LIBAVUTIL_VERSION_INT,
-};
-
-static const AVFilterPad nppsharpen_inputs[] = {{
- .name = "default",
- .type = AVMEDIA_TYPE_VIDEO,
- .filter_frame = nppsharpen_filter_frame,
-}};
-
-static const AVFilterPad nppsharpen_outputs[] = {{
- .name = "default",
- .type = AVMEDIA_TYPE_VIDEO,
- .config_props = nppsharpen_config_props,
-}};
-
-const FFFilter ff_vf_sharpen_npp = {
- .p.name = "sharpen_npp",
- .p.description = NULL_IF_CONFIG_SMALL("NVIDIA Performance Primitives video "
- "sharpening filter."),
- .p.priv_class = &nppsharpen_class,
-
- .init = nppsharpen_init,
- .uninit = nppsharpen_uninit,
-
- .priv_size = sizeof(NPPSharpenContext),
-
- FILTER_INPUTS(nppsharpen_inputs),
- FILTER_OUTPUTS(nppsharpen_outputs),
- FILTER_SINGLE_PIXFMT(AV_PIX_FMT_CUDA),
-
- .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE,
-};
diff --git a/libavfilter/vf_transpose_npp.c b/libavfilter/vf_transpose_npp.c
deleted file mode 100644
index 2315b1043a..0000000000
--- a/libavfilter/vf_transpose_npp.c
+++ /dev/null
@@ -1,482 +0,0 @@
-/*
- * 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 <nppi.h>
-#include <stdio.h>
-#include <string.h>
-
-#include "libavutil/common.h"
-#include "libavutil/hwcontext.h"
-#include "libavutil/hwcontext_cuda_internal.h"
-#include "libavutil/cuda_check.h"
-#include "libavutil/internal.h"
-#include "libavutil/opt.h"
-#include "libavutil/pixdesc.h"
-
-#include "avfilter.h"
-#include "filters.h"
-#include "formats.h"
-#include "video.h"
-
-#define CHECK_CU(x) FF_CUDA_CHECK_DL(ctx, device_hwctx->internal->cuda_dl, x)
-
-static const enum AVPixelFormat supported_formats[] = {
- AV_PIX_FMT_YUV420P,
- AV_PIX_FMT_YUV444P
-};
-
-enum TransposeStage {
- STAGE_ROTATE,
- STAGE_TRANSPOSE,
- STAGE_NB
-};
-
-enum Transpose {
- NPP_TRANSPOSE_CCLOCK_FLIP = 0,
- NPP_TRANSPOSE_CLOCK = 1,
- NPP_TRANSPOSE_CCLOCK = 2,
- NPP_TRANSPOSE_CLOCK_FLIP = 3
-};
-
-enum Passthrough {
- NPP_TRANSPOSE_PT_TYPE_NONE = 0,
- NPP_TRANSPOSE_PT_TYPE_LANDSCAPE,
- NPP_TRANSPOSE_PT_TYPE_PORTRAIT
-};
-
-typedef struct NPPTransposeStageContext {
- int stage_needed;
- enum AVPixelFormat in_fmt;
- enum AVPixelFormat out_fmt;
- struct {
- int width;
- int height;
- } planes_in[3], planes_out[3];
- AVBufferRef *frames_ctx;
- AVFrame *frame;
-} NPPTransposeStageContext;
-
-typedef struct NPPTransposeContext {
- const AVClass *class;
- NPPTransposeStageContext stages[STAGE_NB];
- AVFrame *tmp_frame;
-
- int passthrough; ///< PassthroughType, landscape passthrough mode enabled
- int dir; ///< TransposeDir
-} NPPTransposeContext;
-
-static int npptranspose_init(AVFilterContext *ctx)
-{
- NPPTransposeContext *s = ctx->priv;
- int i;
-
- av_log(ctx, AV_LOG_WARNING, "The libnpp based filters are deprecated.\n");
-
- for (i = 0; i < FF_ARRAY_ELEMS(s->stages); i++) {
- s->stages[i].frame = av_frame_alloc();
- if (!s->stages[i].frame)
- return AVERROR(ENOMEM);
- }
-
- s->tmp_frame = av_frame_alloc();
- if (!s->tmp_frame)
- return AVERROR(ENOMEM);
-
- return 0;
-}
-
-static void npptranspose_uninit(AVFilterContext *ctx)
-{
- NPPTransposeContext *s = ctx->priv;
- int i;
-
- for (i = 0; i < FF_ARRAY_ELEMS(s->stages); i++) {
- av_frame_free(&s->stages[i].frame);
- av_buffer_unref(&s->stages[i].frames_ctx);
- }
-
- av_frame_free(&s->tmp_frame);
-}
-
-static int init_stage(NPPTransposeStageContext *stage, AVBufferRef *device_ctx)
-{
- AVBufferRef *out_ref = NULL;
- AVHWFramesContext *out_ctx;
- int in_sw, in_sh, out_sw, out_sh;
- int ret, i;
-
- av_pix_fmt_get_chroma_sub_sample(stage->in_fmt, &in_sw, &in_sh);
- av_pix_fmt_get_chroma_sub_sample(stage->out_fmt, &out_sw, &out_sh);
-
- if (!stage->planes_out[0].width) {
- stage->planes_out[0].width = stage->planes_in[0].width;
- stage->planes_out[0].height = stage->planes_in[0].height;
- }
-
- for (i = 1; i < FF_ARRAY_ELEMS(stage->planes_in); i++) {
- stage->planes_in[i].width = stage->planes_in[0].width >> in_sw;
- stage->planes_in[i].height = stage->planes_in[0].height >> in_sh;
- stage->planes_out[i].width = stage->planes_out[0].width >> out_sw;
- stage->planes_out[i].height = stage->planes_out[0].height >> out_sh;
- }
-
- out_ref = av_hwframe_ctx_alloc(device_ctx);
- if (!out_ref)
- return AVERROR(ENOMEM);
- out_ctx = (AVHWFramesContext*)out_ref->data;
-
- out_ctx->format = AV_PIX_FMT_CUDA;
- out_ctx->sw_format = stage->out_fmt;
- out_ctx->width = FFALIGN(stage->planes_out[0].width, 32);
- out_ctx->height = FFALIGN(stage->planes_out[0].height, 32);
-
- ret = av_hwframe_ctx_init(out_ref);
- if (ret < 0)
- goto fail;
-
- av_frame_unref(stage->frame);
- ret = av_hwframe_get_buffer(out_ref, stage->frame, 0);
- if (ret < 0)
- goto fail;
-
- stage->frame->width = stage->planes_out[0].width;
- stage->frame->height = stage->planes_out[0].height;
- av_buffer_unref(&stage->frames_ctx);
- stage->frames_ctx = out_ref;
-
- return 0;
-
-fail:
- av_buffer_unref(&out_ref);
- return ret;
-}
-
-static int format_is_supported(enum AVPixelFormat fmt)
-{
- int i;
-
- for (i = 0; i < FF_ARRAY_ELEMS(supported_formats); i++)
- if (supported_formats[i] == fmt)
- return 1;
-
- return 0;
-}
-
-static int init_processing_chain(AVFilterContext *ctx, int in_width, int in_height,
- int out_width, int out_height)
-{
- FilterLink *inl = ff_filter_link(ctx->inputs[0]);
- FilterLink *outl = ff_filter_link(ctx->outputs[0]);
- NPPTransposeContext *s = ctx->priv;
- AVHWFramesContext *in_frames_ctx;
- enum AVPixelFormat format;
- int i, ret, last_stage = -1;
- int rot_width = out_width, rot_height = out_height;
-
- /* check that we have a hw context */
- if (!inl->hw_frames_ctx) {
- av_log(ctx, AV_LOG_ERROR, "No hw context provided on input\n");
- return AVERROR(EINVAL);
- }
-
- in_frames_ctx = (AVHWFramesContext*)inl->hw_frames_ctx->data;
- format = in_frames_ctx->sw_format;
-
- if (!format_is_supported(format)) {
- av_log(ctx, AV_LOG_ERROR, "Unsupported input format: %s\n",
- av_get_pix_fmt_name(format));
- return AVERROR(ENOSYS);
- }
-
- if (s->dir != NPP_TRANSPOSE_CCLOCK_FLIP) {
- s->stages[STAGE_ROTATE].stage_needed = 1;
- }
-
- if (s->dir == NPP_TRANSPOSE_CCLOCK_FLIP || s->dir == NPP_TRANSPOSE_CLOCK_FLIP) {
- s->stages[STAGE_TRANSPOSE].stage_needed = 1;
-
- /* Rotating by 180° in case of clock_flip, or not at all for cclock_flip, so width/height unchanged by rotation */
- rot_width = in_width;
- rot_height = in_height;
- }
-
- s->stages[STAGE_ROTATE].in_fmt = format;
- s->stages[STAGE_ROTATE].out_fmt = format;
- s->stages[STAGE_ROTATE].planes_in[0].width = in_width;
- s->stages[STAGE_ROTATE].planes_in[0].height = in_height;
- s->stages[STAGE_ROTATE].planes_out[0].width = rot_width;
- s->stages[STAGE_ROTATE].planes_out[0].height = rot_height;
- s->stages[STAGE_TRANSPOSE].in_fmt = format;
- s->stages[STAGE_TRANSPOSE].out_fmt = format;
- s->stages[STAGE_TRANSPOSE].planes_in[0].width = rot_width;
- s->stages[STAGE_TRANSPOSE].planes_in[0].height = rot_height;
- s->stages[STAGE_TRANSPOSE].planes_out[0].width = out_width;
- s->stages[STAGE_TRANSPOSE].planes_out[0].height = out_height;
-
- /* init the hardware contexts */
- for (i = 0; i < FF_ARRAY_ELEMS(s->stages); i++) {
- if (!s->stages[i].stage_needed)
- continue;
- ret = init_stage(&s->stages[i], in_frames_ctx->device_ref);
- if (ret < 0)
- return ret;
- last_stage = i;
- }
-
- if (last_stage >= 0) {
- outl->hw_frames_ctx = av_buffer_ref(s->stages[last_stage].frames_ctx);
- } else {
- outl->hw_frames_ctx = av_buffer_ref(inl->hw_frames_ctx);
- s->passthrough = 1;
- }
-
- if (!outl->hw_frames_ctx)
- return AVERROR(ENOMEM);
-
- return 0;
-}
-
-static int npptranspose_config_props(AVFilterLink *outlink)
-{
- FilterLink *outl = ff_filter_link(outlink);
- AVFilterContext *ctx = outlink->src;
- AVFilterLink *inlink = ctx->inputs[0];
- FilterLink *inl = ff_filter_link(inlink);
- NPPTransposeContext *s = ctx->priv;
- int ret;
-
- if ((inlink->w >= inlink->h && s->passthrough == NPP_TRANSPOSE_PT_TYPE_LANDSCAPE) ||
- (inlink->w <= inlink->h && s->passthrough == NPP_TRANSPOSE_PT_TYPE_PORTRAIT))
- {
- if (inl->hw_frames_ctx) {
- outl->hw_frames_ctx = av_buffer_ref(inl->hw_frames_ctx);
- if (!outl->hw_frames_ctx)
- return AVERROR(ENOMEM);
- }
-
- av_log(ctx, AV_LOG_VERBOSE,
- "w:%d h:%d -> w:%d h:%d (passthrough mode)\n",
- inlink->w, inlink->h, inlink->w, inlink->h);
- return 0;
- } else {
- s->passthrough = NPP_TRANSPOSE_PT_TYPE_NONE;
- }
-
- outlink->w = inlink->h;
- outlink->h = inlink->w;
- outlink->sample_aspect_ratio = (AVRational){inlink->sample_aspect_ratio.den, inlink->sample_aspect_ratio.num};
-
- ret = init_processing_chain(ctx, inlink->w, inlink->h, outlink->w, outlink->h);
- if (ret < 0)
- return ret;
-
- av_log(ctx, AV_LOG_VERBOSE, "w:%d h:%d -transpose-> w:%d h:%d\n",
- inlink->w, inlink->h, outlink->w, outlink->h);
-
- return 0;
-}
-
-static int npptranspose_rotate(AVFilterContext *ctx, NPPTransposeStageContext *stage,
- AVFrame *out, AVFrame *in)
-{
- NPPTransposeContext *s = ctx->priv;
- NppStatus err;
- int i;
-
- for (i = 0; i < FF_ARRAY_ELEMS(stage->planes_in) && i < FF_ARRAY_ELEMS(in->data) && in->data[i]; i++) {
- int iw = stage->planes_in[i].width;
- int ih = stage->planes_in[i].height;
- int ow = stage->planes_out[i].width;
- int oh = stage->planes_out[i].height;
-
- // nppRotate uses 0,0 as the rotation point
- // need to shift the image accordingly after rotation
- // need to subtract 1 to get the correct coordinates
- double angle = s->dir == NPP_TRANSPOSE_CLOCK ? -90.0 : s->dir == NPP_TRANSPOSE_CCLOCK ? 90.0 : 180.0;
- int shiftw = (s->dir == NPP_TRANSPOSE_CLOCK || s->dir == NPP_TRANSPOSE_CLOCK_FLIP) ? ow - 1 : 0;
- int shifth = (s->dir == NPP_TRANSPOSE_CCLOCK || s->dir == NPP_TRANSPOSE_CLOCK_FLIP) ? oh - 1 : 0;
-
- err = nppiRotate_8u_C1R(in->data[i], (NppiSize){ iw, ih },
- in->linesize[i], (NppiRect){ 0, 0, iw, ih },
- out->data[i], out->linesize[i],
- (NppiRect){ 0, 0, ow, oh },
- angle, shiftw, shifth, NPPI_INTER_NN);
- if (err != NPP_SUCCESS) {
- av_log(ctx, AV_LOG_ERROR, "NPP rotate error: %d\n", err);
- return AVERROR_UNKNOWN;
- }
- }
-
- return 0;
-}
-
-static int npptranspose_transpose(AVFilterContext *ctx, NPPTransposeStageContext *stage,
- AVFrame *out, AVFrame *in)
-{
- NppStatus err;
- int i;
-
- for (i = 0; i < FF_ARRAY_ELEMS(stage->planes_in) && i < FF_ARRAY_ELEMS(in->data) && in->data[i]; i++) {
- int iw = stage->planes_in[i].width;
- int ih = stage->planes_in[i].height;
-
- err = nppiTranspose_8u_C1R(in->data[i], in->linesize[i],
- out->data[i], out->linesize[i],
- (NppiSize){ iw, ih });
- if (err != NPP_SUCCESS) {
- av_log(ctx, AV_LOG_ERROR, "NPP transpose error: %d\n", err);
- return AVERROR_UNKNOWN;
- }
- }
-
- return 0;
-}
-
-static int (*const npptranspose_process[])(AVFilterContext *ctx, NPPTransposeStageContext *stage,
- AVFrame *out, AVFrame *in) = {
- [STAGE_ROTATE] = npptranspose_rotate,
- [STAGE_TRANSPOSE] = npptranspose_transpose
-};
-
-static int npptranspose_filter(AVFilterContext *ctx, AVFrame *out, AVFrame *in)
-{
- NPPTransposeContext *s = ctx->priv;
- AVFrame *src = in;
- int i, ret, last_stage = -1;
-
- for (i = 0; i < FF_ARRAY_ELEMS(s->stages); i++) {
- if (!s->stages[i].stage_needed)
- continue;
-
- ret = npptranspose_process[i](ctx, &s->stages[i], s->stages[i].frame, src);
- if (ret < 0)
- return ret;
-
- src = s->stages[i].frame;
- last_stage = i;
- }
-
- if (last_stage < 0)
- return AVERROR_BUG;
-
- ret = av_hwframe_get_buffer(src->hw_frames_ctx, s->tmp_frame, 0);
- if (ret < 0)
- return ret;
-
- av_frame_move_ref(out, src);
- av_frame_move_ref(src, s->tmp_frame);
-
- ret = av_frame_copy_props(out, in);
- if (ret < 0)
- return ret;
-
- return 0;
-}
-
-static int npptranspose_filter_frame(AVFilterLink *link, AVFrame *in)
-{
- AVFilterContext *ctx = link->dst;
- NPPTransposeContext *s = ctx->priv;
- AVFilterLink *outlink = ctx->outputs[0];
- FilterLink *outl = ff_filter_link(outlink);
- AVHWFramesContext *frames_ctx = (AVHWFramesContext*)outl->hw_frames_ctx->data;
- AVCUDADeviceContext *device_hwctx = frames_ctx->device_ctx->hwctx;
- AVFrame *out = NULL;
- CUcontext dummy;
- int ret = 0;
-
- if (s->passthrough)
- return ff_filter_frame(outlink, in);
-
- out = av_frame_alloc();
- if (!out) {
- ret = AVERROR(ENOMEM);
- goto fail;
- }
-
- ret = CHECK_CU(device_hwctx->internal->cuda_dl->cuCtxPushCurrent(device_hwctx->cuda_ctx));
- if (ret < 0)
- goto fail;
-
- ret = npptranspose_filter(ctx, out, in);
-
- CHECK_CU(device_hwctx->internal->cuda_dl->cuCtxPopCurrent(&dummy));
- if (ret < 0)
- goto fail;
-
- av_frame_free(&in);
-
- return ff_filter_frame(outlink, out);
-
-fail:
- av_frame_free(&in);
- av_frame_free(&out);
- return ret;
-}
-
-#define OFFSET(x) offsetof(NPPTransposeContext, x)
-#define FLAGS (AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM)
-
-static const AVOption options[] = {
- { "dir", "set transpose direction", OFFSET(dir), AV_OPT_TYPE_INT, { .i64 = NPP_TRANSPOSE_CCLOCK_FLIP }, 0, 3, FLAGS, .unit = "dir" },
- { "cclock_flip", "rotate counter-clockwise with vertical flip", 0, AV_OPT_TYPE_CONST, { .i64 = NPP_TRANSPOSE_CCLOCK_FLIP }, 0, 0, FLAGS, .unit = "dir" },
- { "clock", "rotate clockwise", 0, AV_OPT_TYPE_CONST, { .i64 = NPP_TRANSPOSE_CLOCK }, 0, 0, FLAGS, .unit = "dir" },
- { "cclock", "rotate counter-clockwise", 0, AV_OPT_TYPE_CONST, { .i64 = NPP_TRANSPOSE_CCLOCK }, 0, 0, FLAGS, .unit = "dir" },
- { "clock_flip", "rotate clockwise with vertical flip", 0, AV_OPT_TYPE_CONST, { .i64 = NPP_TRANSPOSE_CLOCK_FLIP }, 0, 0, FLAGS, .unit = "dir" },
- { "passthrough", "do not apply transposition if the input matches the specified geometry", OFFSET(passthrough), AV_OPT_TYPE_INT, { .i64 = NPP_TRANSPOSE_PT_TYPE_NONE }, 0, 2, FLAGS, .unit = "passthrough" },
- { "none", "always apply transposition", 0, AV_OPT_TYPE_CONST, { .i64 = NPP_TRANSPOSE_PT_TYPE_NONE }, 0, 0, FLAGS, .unit = "passthrough" },
- { "landscape", "preserve landscape geometry", 0, AV_OPT_TYPE_CONST, { .i64 = NPP_TRANSPOSE_PT_TYPE_LANDSCAPE }, 0, 0, FLAGS, .unit = "passthrough" },
- { "portrait", "preserve portrait geometry", 0, AV_OPT_TYPE_CONST, { .i64 = NPP_TRANSPOSE_PT_TYPE_PORTRAIT }, 0, 0, FLAGS, .unit = "passthrough" },
- { NULL },
-};
-
-static const AVClass npptranspose_class = {
- .class_name = "npptranspose",
- .item_name = av_default_item_name,
- .option = options,
- .version = LIBAVUTIL_VERSION_INT,
-};
-
-static const AVFilterPad npptranspose_inputs[] = {
- {
- .name = "default",
- .type = AVMEDIA_TYPE_VIDEO,
- .filter_frame = npptranspose_filter_frame,
- },
-};
-
-static const AVFilterPad npptranspose_outputs[] = {
- {
- .name = "default",
- .type = AVMEDIA_TYPE_VIDEO,
- .config_props = npptranspose_config_props,
- },
-};
-
-const FFFilter ff_vf_transpose_npp = {
- .p.name = "transpose_npp",
- .p.description = NULL_IF_CONFIG_SMALL("NVIDIA Performance Primitives video transpose"),
- .p.priv_class = &npptranspose_class,
- .init = npptranspose_init,
- .uninit = npptranspose_uninit,
- .priv_size = sizeof(NPPTransposeContext),
- FILTER_INPUTS(npptranspose_inputs),
- FILTER_OUTPUTS(npptranspose_outputs),
- FILTER_SINGLE_PIXFMT(AV_PIX_FMT_CUDA),
- .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE,
-};
--
2.52.0
From 476e3bc55b326e3951bbd9fe72d247dc9109706b Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
Date: Sun, 8 Mar 2026 20:09:14 +0100
Subject: [PATCH 05/33] avformat: Remove FF_API_INTERNAL_TIMING
Deprecated since 2024-07-09.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
---
libavformat/avformat.c | 72 -------------------------------------
libavformat/avformat.h | 26 --------------
libavformat/internal.h | 4 ---
libavformat/options.c | 3 --
libavformat/version_major.h | 2 --
5 files changed, 107 deletions(-)
diff --git a/libavformat/avformat.c b/libavformat/avformat.c
index dbd4792cd2..15806aa6f6 100644
--- a/libavformat/avformat.c
+++ b/libavformat/avformat.c
@@ -25,7 +25,6 @@
#include "libavutil/channel_layout.h"
#include "libavutil/frame.h"
#include "libavutil/iamf.h"
-#include "libavutil/intreadwrite.h"
#include "libavutil/mem.h"
#include "libavutil/opt.h"
#include "libavutil/pixfmt.h"
@@ -828,77 +827,6 @@ AVRational av_guess_frame_rate(AVFormatContext *format, AVStream *st, AVFrame *f
return fr;
}
-#if FF_API_INTERNAL_TIMING
-int avformat_transfer_internal_stream_timing_info(const AVOutputFormat *ofmt,
- AVStream *ost, const AVStream *ist,
- enum AVTimebaseSource copy_tb)
-{
- const AVCodecDescriptor *desc = cffstream(ist)->codec_desc;
- const AVCodecContext *const dec_ctx = cffstream(ist)->avctx;
-
- AVRational mul = (AVRational){ desc && (desc->props & AV_CODEC_PROP_FIELDS) ? 2 : 1, 1 };
- AVRational dec_ctx_framerate = dec_ctx ? dec_ctx->framerate : (AVRational){ 0, 0 };
- AVRational dec_ctx_tb = dec_ctx_framerate.num ? av_inv_q(av_mul_q(dec_ctx_framerate, mul))
- : (ist->codecpar->codec_type == AVMEDIA_TYPE_AUDIO ? (AVRational){0, 1}
- : ist->time_base);
- AVRational enc_tb = ist->time_base;
-
- /*
- * Avi is a special case here because it supports variable fps but
- * having the fps and timebase differe significantly adds quite some
- * overhead
- */
- if (!strcmp(ofmt->name, "avi")) {
-#if FF_API_R_FRAME_RATE
- if (copy_tb == AVFMT_TBCF_AUTO && ist->r_frame_rate.num
- && av_q2d(ist->r_frame_rate) >= av_q2d(ist->avg_frame_rate)
- && 0.5/av_q2d(ist->r_frame_rate) > av_q2d(ist->time_base)
- && 0.5/av_q2d(ist->r_frame_rate) > av_q2d(dec_ctx_tb)
- && av_q2d(ist->time_base) < 1.0/500 && av_q2d(dec_ctx_tb) < 1.0/500
- || copy_tb == AVFMT_TBCF_R_FRAMERATE) {
- enc_tb.num = ist->r_frame_rate.den;
- enc_tb.den = 2*ist->r_frame_rate.num;
- } else
-#endif
- if (copy_tb == AVFMT_TBCF_AUTO && dec_ctx_framerate.num &&
- av_q2d(av_inv_q(dec_ctx_framerate)) > 2*av_q2d(ist->time_base)
- && av_q2d(ist->time_base) < 1.0/500
- || (copy_tb == AVFMT_TBCF_DECODER &&
- (dec_ctx_framerate.num || ist->codecpar->codec_type == AVMEDIA_TYPE_AUDIO))) {
- enc_tb = dec_ctx_tb;
- enc_tb.den *= 2;
- }
- } else if (!(ofmt->flags & AVFMT_VARIABLE_FPS)
- && !av_match_name(ofmt->name, "mov,mp4,3gp,3g2,psp,ipod,ismv,f4v")) {
- if (copy_tb == AVFMT_TBCF_AUTO && dec_ctx_framerate.num
- && av_q2d(av_inv_q(dec_ctx_framerate)) > av_q2d(ist->time_base)
- && av_q2d(ist->time_base) < 1.0/500
- || (copy_tb == AVFMT_TBCF_DECODER &&
- (dec_ctx_framerate.num || ist->codecpar->codec_type == AVMEDIA_TYPE_AUDIO))) {
- enc_tb = dec_ctx_tb;
- }
- }
-
- if (ost->codecpar->codec_tag == AV_RL32("tmcd")
- && dec_ctx_tb.num < dec_ctx_tb.den
- && dec_ctx_tb.num > 0
- && 121LL*dec_ctx_tb.num > dec_ctx_tb.den) {
- enc_tb = dec_ctx_tb;
- }
-
- av_reduce(&ffstream(ost)->transferred_mux_tb.num,
- &ffstream(ost)->transferred_mux_tb.den,
- enc_tb.num, enc_tb.den, INT_MAX);
-
- return 0;
-}
-
-AVRational av_stream_get_codec_timebase(const AVStream *st)
-{
- return cffstream(st)->avctx ? cffstream(st)->avctx->time_base : cffstream(st)->transferred_mux_tb;
-}
-#endif
-
void avpriv_set_pts_info(AVStream *st, int pts_wrap_bits,
unsigned int pts_num, unsigned int pts_den)
{
diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index 1efe383b25..ef2b08c4f3 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -3185,32 +3185,6 @@ int avformat_match_stream_specifier(AVFormatContext *s, AVStream *st,
int avformat_queue_attached_pictures(AVFormatContext *s);
-#if FF_API_INTERNAL_TIMING
-enum AVTimebaseSource {
- AVFMT_TBCF_AUTO = -1,
- AVFMT_TBCF_DECODER,
- AVFMT_TBCF_DEMUXER,
-#if FF_API_R_FRAME_RATE
- AVFMT_TBCF_R_FRAMERATE,
-#endif
-};
-
-/**
- * @deprecated do not call this function
- */
-attribute_deprecated
-int avformat_transfer_internal_stream_timing_info(const AVOutputFormat *ofmt,
- AVStream *ost, const AVStream *ist,
- enum AVTimebaseSource copy_tb);
-
-/**
- * @deprecated do not call this function
- */
-attribute_deprecated
-AVRational av_stream_get_codec_timebase(const AVStream *st);
-#endif
-
-
/**
* @}
*/
diff --git a/libavformat/internal.h b/libavformat/internal.h
index 8bf9444edb..4f46c19808 100644
--- a/libavformat/internal.h
+++ b/libavformat/internal.h
@@ -353,10 +353,6 @@ typedef struct FFStream {
int64_t cur_dts;
const struct AVCodecDescriptor *codec_desc;
-
-#if FF_API_INTERNAL_TIMING
- AVRational transferred_mux_tb;
-#endif
} FFStream;
static av_always_inline FFStream *ffstream(AVStream *st)
diff --git a/libavformat/options.c b/libavformat/options.c
index 6da1b690c6..4b743bb529 100644
--- a/libavformat/options.c
+++ b/libavformat/options.c
@@ -316,9 +316,6 @@ AVStream *avformat_new_stream(AVFormatContext *s, const AVCodec *c)
sti->pts_buffer[i] = AV_NOPTS_VALUE;
st->sample_aspect_ratio = (AVRational) { 0, 1 };
-#if FF_API_INTERNAL_TIMING
- sti->transferred_mux_tb = (AVRational) { 0, 1 };;
-#endif
sti->need_context_update = 1;
diff --git a/libavformat/version_major.h b/libavformat/version_major.h
index 2cae480a4b..ace2f00791 100644
--- a/libavformat/version_major.h
+++ b/libavformat/version_major.h
@@ -43,8 +43,6 @@
*/
#define FF_API_COMPUTE_PKT_FIELDS2 (LIBAVFORMAT_VERSION_MAJOR < 63)
-#define FF_API_INTERNAL_TIMING (LIBAVFORMAT_VERSION_MAJOR < 63)
-
#define FF_API_NO_DEFAULT_TLS_VERIFY (LIBAVFORMAT_VERSION_MAJOR < 63)
#define FF_API_FDEBUG_TS (LIBAVFORMAT_VERSION_MAJOR < 63)
--
2.52.0
From d46d04f1fc71e70efdb86be4a3a14dc3bbe82e97 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
Date: Sun, 8 Mar 2026 20:11:50 +0100
Subject: [PATCH 06/33] avformat/tls: Remove FF_API_NO_DEFAULT_TLS_VERIFY
The decision to switch to checking peer certificates by default
at the next major version bump was announced on 2025-08-09
in commit 5621eee672391680f432075865e7580189ad0097.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
---
libavformat/tls.h | 11 ++---------
libavformat/version_major.h | 2 --
2 files changed, 2 insertions(+), 11 deletions(-)
diff --git a/libavformat/tls.h b/libavformat/tls.h
index 971ae5c7a5..f2f4f8991f 100644
--- a/libavformat/tls.h
+++ b/libavformat/tls.h
@@ -25,7 +25,6 @@
#include "libavutil/bprint.h"
#include "libavutil/opt.h"
-#include "version.h"
#include "url.h"
@@ -88,17 +87,11 @@ typedef struct TLSShared {
#define TLS_OPTFL (AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_ENCODING_PARAM)
-#if FF_API_NO_DEFAULT_TLS_VERIFY
-#define TLS_VERIFY_DEFAULT 0
-#else
-#define TLS_VERIFY_DEFAULT 1
-#endif
-
#define FF_TLS_CLIENT_OPTIONS(pstruct, options_field) \
{"ca_file", "Certificate Authority database file", offsetof(pstruct, options_field . ca_file), AV_OPT_TYPE_STRING, .flags = TLS_OPTFL }, \
{"cafile", "Certificate Authority database file", offsetof(pstruct, options_field . ca_file), AV_OPT_TYPE_STRING, .flags = TLS_OPTFL }, \
- {"tls_verify", "Verify the peer certificate", offsetof(pstruct, options_field . verify), AV_OPT_TYPE_BOOL, { .i64 = TLS_VERIFY_DEFAULT }, 0, 1, .flags = TLS_OPTFL }, \
- {"verify", "Verify the peer certificate", offsetof(pstruct, options_field . verify), AV_OPT_TYPE_BOOL, { .i64 = TLS_VERIFY_DEFAULT }, 0, 1, .flags = TLS_OPTFL }, \
+ {"tls_verify", "Verify the peer certificate", offsetof(pstruct, options_field . verify), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, .flags = TLS_OPTFL }, \
+ {"verify", "Verify the peer certificate", offsetof(pstruct, options_field . verify), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, .flags = TLS_OPTFL }, \
{"cert_file", "Certificate file", offsetof(pstruct, options_field . cert_file), AV_OPT_TYPE_STRING, .flags = TLS_OPTFL }, \
{"cert", "Certificate file", offsetof(pstruct, options_field . cert_file), AV_OPT_TYPE_STRING, .flags = TLS_OPTFL }, \
{"key_file", "Private key file", offsetof(pstruct, options_field . key_file), AV_OPT_TYPE_STRING, .flags = TLS_OPTFL }, \
diff --git a/libavformat/version_major.h b/libavformat/version_major.h
index ace2f00791..d2bf618fcd 100644
--- a/libavformat/version_major.h
+++ b/libavformat/version_major.h
@@ -43,8 +43,6 @@
*/
#define FF_API_COMPUTE_PKT_FIELDS2 (LIBAVFORMAT_VERSION_MAJOR < 63)
-#define FF_API_NO_DEFAULT_TLS_VERIFY (LIBAVFORMAT_VERSION_MAJOR < 63)
-
#define FF_API_FDEBUG_TS (LIBAVFORMAT_VERSION_MAJOR < 63)
#define FF_API_LCEVC_STRUCT (LIBAVFORMAT_VERSION_MAJOR < 64)
--
2.52.0
From 2baaeaad692bb65ffca0163c2b9a04d0de1e282b Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
Date: Mon, 9 Mar 2026 10:20:00 +0100
Subject: [PATCH 07/33] avformat/oggenc: Remove deprecated pagesize option
Deprecated in commit 59220d559b5077c15fa6434e42df95f3b92f0199.
on 2013-01-08.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
---
libavformat/oggenc.c | 14 --------------
1 file changed, 14 deletions(-)
diff --git a/libavformat/oggenc.c b/libavformat/oggenc.c
index 754432cb81..5c7e3da0bc 100644
--- a/libavformat/oggenc.c
+++ b/libavformat/oggenc.c
@@ -77,9 +77,6 @@ typedef struct OGGPageList {
typedef struct OGGContext {
const AVClass *class;
OGGPageList *page_list;
-#if LIBAVFORMAT_VERSION_MAJOR < 63
- int pref_size; ///< preferred page size (0 => fill all segments)
-#endif
int64_t pref_duration; ///< preferred page duration (0 => fill all segments)
int serial_offset;
int failed; // if true all packet submission will fail.
@@ -93,12 +90,6 @@ static int ogg_write_trailer(AVFormatContext *s);
static const AVOption options[] = {
{ "serial_offset", "serial number offset",
OFFSET(serial_offset), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, PARAM },
-#if LIBAVFORMAT_VERSION_MAJOR < 63
- { "oggpagesize", "Set preferred Ogg page size.",
- OFFSET(pref_size), AV_OPT_TYPE_INT, {.i64 = 0}, 0, MAX_PAGE_SIZE, PARAM | AV_OPT_FLAG_DEPRECATED },
- { "pagesize", "preferred page size in bytes",
- OFFSET(pref_size), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, MAX_PAGE_SIZE, PARAM | AV_OPT_FLAG_DEPRECATED },
-#endif
{ "page_duration", "preferred page duration, in microseconds",
OFFSET(pref_duration), AV_OPT_TYPE_INT64, { .i64 = 1000000 }, 0, INT64_MAX, PARAM },
{ NULL },
@@ -284,12 +275,7 @@ static int ogg_buffer_data(AVFormatContext *s, AVStream *st,
if (page->segments_count == 255) {
ogg_buffer_page(s, oggstream);
} else if (!header) {
-#if LIBAVFORMAT_VERSION_MAJOR < 63
- if ((ogg->pref_size > 0 && page->size >= ogg->pref_size) ||
- (ogg->pref_duration > 0 && next - start >= ogg->pref_duration)) {
-#else
if (ogg->pref_duration > 0 && next - start >= ogg->pref_duration) {
-#endif
ogg_buffer_page(s, oggstream);
}
}
--
2.52.0
From ec9fe319cc148f01b8b300962b87f853c338078f Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
Date: Sun, 8 Mar 2026 20:41:02 +0100
Subject: [PATCH 08/33] avcodec: Remove FF_CODEC_OMX
The omx encoders were deprecated on 2024-11-09.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
---
MAINTAINERS | 1 -
configure | 16 -
libavcodec/Makefile | 2 -
libavcodec/allcodecs.c | 2 -
libavcodec/omx.c | 986 -------------------------------------
libavcodec/version_major.h | 3 -
6 files changed, 1010 deletions(-)
delete mode 100644 libavcodec/omx.c
diff --git a/MAINTAINERS b/MAINTAINERS
index cdaf9b251a..67920dd89e 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -234,7 +234,6 @@ Codecs:
nuv.c Reimar Doeffinger
nvdec*, nvenc* Timo Rothenpieler
oh* Zhao Zhili
- omx.c Martin Storsjo, Aman Gupta
opus* Rostislav Pehlivanov
pcx.c Ivo van Poorten
pgssubdec.c Reimar Doeffinger
diff --git a/configure b/configure
index dc732587cc..74658b964f 100755
--- a/configure
+++ b/configure
@@ -363,8 +363,6 @@ External library support:
--enable-mmal enable Broadcom Multi-Media Abstraction Layer (Raspberry Pi) via MMAL [no]
--disable-nvdec disable Nvidia video decoding acceleration (via hwaccel) [autodetect]
--disable-nvenc disable Nvidia video encoding code [autodetect]
- --enable-omx enable OpenMAX IL code [no]
- --enable-omx-rpi enable OpenMAX IL code for Raspberry Pi [no]
--enable-rkmpp enable Rockchip Media Process Platform code [no]
--disable-v4l2-m2m disable V4L2 mem2mem code [autodetect]
--disable-vaapi disable Video Acceleration API (mainly Unix/Intel) code [autodetect]
@@ -2203,7 +2201,6 @@ HWACCEL_LIBRARY_LIST="
libmfx
libvpl
mmal
- omx
opencl
"
@@ -2220,7 +2217,6 @@ FEATURE_LIST="
ftrapv
gray
hardcoded_tables
- omx_rpi
runtime_cpudetect
safe_bitstream_reader
shared
@@ -3567,8 +3563,6 @@ wmv3_vdpau_hwaccel_select="vc1_vdpau_hwaccel"
# hardware-accelerated codecs
d3d12va_encode_deps="d3d12va ID3D12VideoEncoder d3d12_encoder_feature"
mediafoundation_deps="mftransform_h MFCreateAlignedMemoryBuffer"
-omx_deps="libdl pthreads"
-omx_rpi_select="omx"
qsv_deps="libmfx"
qsvdec_select="qsv"
qsvenc_select="qsv"
@@ -3652,7 +3646,6 @@ h264_nvenc_encoder_select="atsc_a53"
h264_oh_decoder_deps="ohcodec"
h264_oh_decoder_select="h264_mp4toannexb_bsf"
h264_oh_encoder_deps="ohcodec"
-h264_omx_encoder_deps="omx"
h264_qsv_decoder_select="h264_mp4toannexb_bsf qsvdec"
h264_qsv_encoder_select="atsc_a53 qsvenc"
h264_rkmpp_decoder_deps="rkmpp"
@@ -3712,7 +3705,6 @@ mpeg4_mediacodec_decoder_deps="mediacodec"
mpeg4_mediacodec_encoder_deps="mediacodec"
mpeg4_mediacodec_encoder_select="extract_extradata_bsf"
mpeg4_mmal_decoder_deps="mmal"
-mpeg4_omx_encoder_deps="omx"
mpeg4_v4l2m2m_decoder_deps="v4l2_m2m mpeg4_v4l2_m2m"
mpeg4_v4l2m2m_encoder_deps="v4l2_m2m mpeg4_v4l2_m2m"
vc1_cuvid_decoder_deps="cuvid"
@@ -7578,14 +7570,6 @@ enabled opengl && { check_lib opengl GL/glx.h glXGetProcAddress "-lGL
check_lib opengl ES2/gl.h glGetError "-isysroot=${sysroot} -framework OpenGLES" ||
die "ERROR: opengl not found."
}
-enabled omx_rpi && { test_code cc OMX_Core.h OMX_IndexConfigBrcmVideoRequestIFrame ||
- { ! enabled cross_compile &&
- add_cflags -isystem/opt/vc/include/IL &&
- test_code cc OMX_Core.h OMX_IndexConfigBrcmVideoRequestIFrame; } ||
- die "ERROR: OpenMAX IL headers from raspberrypi/firmware not found"; } &&
- enable omx
-enabled omx && require_headers OMX_Core.h && \
- warn "The OpenMAX encoders are deprecated and will be removed in future versions"
enabled openssl && { { check_pkg_config openssl "openssl >= 3.0.0" openssl/ssl.h DTLS_get_data_mtu &&
{ enabled gplv3 || ! enabled gpl || enabled nonfree || die "ERROR: OpenSSL >=3.0.0 requires --enable-version3"; }; } ||
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index ffbacc2ed3..ea5553c76f 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -442,7 +442,6 @@ OBJS-$(CONFIG_H264_MMAL_DECODER) += mmaldec.o
OBJS-$(CONFIG_H264_NVENC_ENCODER) += nvenc_h264.o nvenc.o
OBJS-$(CONFIG_H264_OH_DECODER) += ohcodec.o ohdec.o
OBJS-$(CONFIG_H264_OH_ENCODER) += ohcodec.o ohenc.o
-OBJS-$(CONFIG_H264_OMX_ENCODER) += omx.o
OBJS-$(CONFIG_H264_QSV_DECODER) += qsvdec.o
OBJS-$(CONFIG_H264_QSV_ENCODER) += qsvenc_h264.o
OBJS-$(CONFIG_H264_RKMPP_DECODER) += rkmppdec.o
@@ -587,7 +586,6 @@ OBJS-$(CONFIG_MPEG4_ENCODER) += mpeg4videoenc.o
OBJS-$(CONFIG_MPEG4_CUVID_DECODER) += cuviddec.o
OBJS-$(CONFIG_MPEG4_MEDIACODEC_DECODER) += mediacodecdec.o
OBJS-$(CONFIG_MPEG4_MEDIACODEC_ENCODER) += mediacodecenc.o
-OBJS-$(CONFIG_MPEG4_OMX_ENCODER) += omx.o
OBJS-$(CONFIG_MPEG4_V4L2M2M_DECODER) += v4l2_m2m_dec.o
OBJS-$(CONFIG_MPEG4_V4L2M2M_ENCODER) += v4l2_m2m_enc.o
OBJS-$(CONFIG_MPL2_DECODER) += mpl2dec.o ass.o
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index 314cb230a4..d9375bce20 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -882,7 +882,6 @@ extern const FFCodec ff_h264_mf_encoder;
extern const FFCodec ff_h264_nvenc_encoder;
extern const FFCodec ff_h264_oh_decoder;
extern const FFCodec ff_h264_oh_encoder;
-extern const FFCodec ff_h264_omx_encoder;
extern const FFCodec ff_h264_qsv_encoder;
extern const FFCodec ff_h264_v4l2m2m_encoder;
extern const FFCodec ff_h264_vaapi_encoder;
@@ -917,7 +916,6 @@ extern const FFCodec ff_mpeg2_vaapi_encoder;
extern const FFCodec ff_mpeg4_cuvid_decoder;
extern const FFCodec ff_mpeg4_mediacodec_decoder;
extern const FFCodec ff_mpeg4_mediacodec_encoder;
-extern const FFCodec ff_mpeg4_omx_encoder;
extern const FFCodec ff_mpeg4_v4l2m2m_encoder;
extern const FFCodec ff_prores_videotoolbox_encoder;
extern const FFCodec ff_vc1_cuvid_decoder;
diff --git a/libavcodec/omx.c b/libavcodec/omx.c
deleted file mode 100644
index 7b003ac1b7..0000000000
--- a/libavcodec/omx.c
+++ /dev/null
@@ -1,986 +0,0 @@
-/*
- * OMX Video encoder
- * Copyright (C) 2011 Martin Storsjo
- *
- * 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 "config.h"
-
-#if CONFIG_OMX_RPI
-#define OMX_SKIP64BIT
-#endif
-
-#include <dlfcn.h>
-#include <OMX_Core.h>
-#include <OMX_Component.h>
-#include <pthread.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/time.h>
-
-#include "libavutil/avstring.h"
-#include "libavutil/avutil.h"
-#include "libavutil/common.h"
-#include "libavutil/imgutils.h"
-#include "libavutil/log.h"
-#include "libavutil/mem.h"
-#include "libavutil/opt.h"
-
-#include "avcodec.h"
-#include "codec_internal.h"
-#include "h264.h"
-#include "pthread_internal.h"
-
-#ifdef OMX_SKIP64BIT
-static OMX_TICKS to_omx_ticks(int64_t value)
-{
- OMX_TICKS s;
- s.nLowPart = value & 0xffffffff;
- s.nHighPart = value >> 32;
- return s;
-}
-static int64_t from_omx_ticks(OMX_TICKS value)
-{
- return (((int64_t)value.nHighPart) << 32) | value.nLowPart;
-}
-#else
-#define to_omx_ticks(x) (x)
-#define from_omx_ticks(x) (x)
-#endif
-
-#define INIT_STRUCT(x) do { \
- x.nSize = sizeof(x); \
- x.nVersion = s->version; \
- } while (0)
-#define CHECK(x) do { \
- if (x != OMX_ErrorNone) { \
- av_log(avctx, AV_LOG_ERROR, \
- "err %x (%d) on line %d\n", x, x, __LINE__); \
- return AVERROR_UNKNOWN; \
- } \
- } while (0)
-
-typedef struct OMXContext {
- void *lib;
- void *lib2;
- OMX_ERRORTYPE (*ptr_Init)(void);
- OMX_ERRORTYPE (*ptr_Deinit)(void);
- OMX_ERRORTYPE (*ptr_ComponentNameEnum)(OMX_STRING, OMX_U32, OMX_U32);
- OMX_ERRORTYPE (*ptr_GetHandle)(OMX_HANDLETYPE*, OMX_STRING, OMX_PTR, OMX_CALLBACKTYPE*);
- OMX_ERRORTYPE (*ptr_FreeHandle)(OMX_HANDLETYPE);
- OMX_ERRORTYPE (*ptr_GetComponentsOfRole)(OMX_STRING, OMX_U32*, OMX_U8**);
- OMX_ERRORTYPE (*ptr_GetRolesOfComponent)(OMX_STRING, OMX_U32*, OMX_U8**);
- void (*host_init)(void);
-} OMXContext;
-
-static av_cold void *dlsym_prefixed(void *handle, const char *symbol, const char *prefix)
-{
- char buf[50];
- snprintf(buf, sizeof(buf), "%s%s", prefix ? prefix : "", symbol);
- return dlsym(handle, buf);
-}
-
-static av_cold int omx_try_load(OMXContext *s, void *logctx,
- const char *libname, const char *prefix,
- const char *libname2)
-{
- if (libname2) {
- s->lib2 = dlopen(libname2, RTLD_NOW | RTLD_GLOBAL);
- if (!s->lib2) {
- av_log(logctx, AV_LOG_WARNING, "%s not found\n", libname2);
- return AVERROR_ENCODER_NOT_FOUND;
- }
- s->host_init = dlsym(s->lib2, "bcm_host_init");
- if (!s->host_init) {
- av_log(logctx, AV_LOG_WARNING, "bcm_host_init not found\n");
- dlclose(s->lib2);
- s->lib2 = NULL;
- return AVERROR_ENCODER_NOT_FOUND;
- }
- }
- s->lib = dlopen(libname, RTLD_NOW | RTLD_GLOBAL);
- if (!s->lib) {
- av_log(logctx, AV_LOG_WARNING, "%s not found\n", libname);
- return AVERROR_ENCODER_NOT_FOUND;
- }
- s->ptr_Init = dlsym_prefixed(s->lib, "OMX_Init", prefix);
- s->ptr_Deinit = dlsym_prefixed(s->lib, "OMX_Deinit", prefix);
- s->ptr_ComponentNameEnum = dlsym_prefixed(s->lib, "OMX_ComponentNameEnum", prefix);
- s->ptr_GetHandle = dlsym_prefixed(s->lib, "OMX_GetHandle", prefix);
- s->ptr_FreeHandle = dlsym_prefixed(s->lib, "OMX_FreeHandle", prefix);
- s->ptr_GetComponentsOfRole = dlsym_prefixed(s->lib, "OMX_GetComponentsOfRole", prefix);
- s->ptr_GetRolesOfComponent = dlsym_prefixed(s->lib, "OMX_GetRolesOfComponent", prefix);
- if (!s->ptr_Init || !s->ptr_Deinit || !s->ptr_ComponentNameEnum ||
- !s->ptr_GetHandle || !s->ptr_FreeHandle ||
- !s->ptr_GetComponentsOfRole || !s->ptr_GetRolesOfComponent) {
- av_log(logctx, AV_LOG_WARNING, "Not all functions found in %s\n", libname);
- dlclose(s->lib);
- s->lib = NULL;
- if (s->lib2)
- dlclose(s->lib2);
- s->lib2 = NULL;
- return AVERROR_ENCODER_NOT_FOUND;
- }
- return 0;
-}
-
-static av_cold OMXContext *omx_init(void *logctx, const char *libname, const char *prefix)
-{
- static const char * const libnames[] = {
-#if CONFIG_OMX_RPI
- "/opt/vc/lib/libopenmaxil.so", "/opt/vc/lib/libbcm_host.so",
-#else
- "libOMX_Core.so", NULL,
- "libOmxCore.so", NULL,
-#endif
- NULL
- };
- const char* const* nameptr;
- int ret = AVERROR_ENCODER_NOT_FOUND;
- OMXContext *omx_context;
-
- omx_context = av_mallocz(sizeof(*omx_context));
- if (!omx_context)
- return NULL;
- if (libname) {
- ret = omx_try_load(omx_context, logctx, libname, prefix, NULL);
- if (ret < 0) {
- av_free(omx_context);
- return NULL;
- }
- } else {
- for (nameptr = libnames; *nameptr; nameptr += 2)
- if (!(ret = omx_try_load(omx_context, logctx, nameptr[0], prefix, nameptr[1])))
- break;
- if (!*nameptr) {
- av_free(omx_context);
- return NULL;
- }
- }
-
- if (omx_context->host_init)
- omx_context->host_init();
- omx_context->ptr_Init();
- return omx_context;
-}
-
-static av_cold void omx_deinit(OMXContext *omx_context)
-{
- if (!omx_context)
- return;
- omx_context->ptr_Deinit();
- dlclose(omx_context->lib);
- av_free(omx_context);
-}
-
-typedef struct OMXCodecContext {
- const AVClass *class;
- char *libname;
- char *libprefix;
- OMXContext *omx_context;
-
- AVCodecContext *avctx;
-
- char component_name[OMX_MAX_STRINGNAME_SIZE];
- OMX_VERSIONTYPE version;
- OMX_HANDLETYPE handle;
- int in_port, out_port;
- OMX_COLOR_FORMATTYPE color_format;
- int stride, plane_size;
-
- int num_in_buffers, num_out_buffers;
- OMX_BUFFERHEADERTYPE **in_buffer_headers;
- OMX_BUFFERHEADERTYPE **out_buffer_headers;
- int num_free_in_buffers;
- OMX_BUFFERHEADERTYPE **free_in_buffers;
- int num_done_out_buffers;
- OMX_BUFFERHEADERTYPE **done_out_buffers;
- pthread_mutex_t input_mutex;
- pthread_cond_t input_cond;
- pthread_mutex_t output_mutex;
- pthread_cond_t output_cond;
-
- pthread_mutex_t state_mutex;
- pthread_cond_t state_cond;
- OMX_STATETYPE state;
- OMX_ERRORTYPE error;
-
- unsigned mutex_cond_inited_cnt;
-
- int eos_sent, got_eos;
-
- uint8_t *output_buf;
- int output_buf_size;
-
- int input_zerocopy;
- int profile;
-} OMXCodecContext;
-
-#define NB_MUTEX_CONDS 6
-#define OFF(field) offsetof(OMXCodecContext, field)
-DEFINE_OFFSET_ARRAY(OMXCodecContext, omx_codec_context, mutex_cond_inited_cnt,
- (OFF(input_mutex), OFF(output_mutex), OFF(state_mutex)),
- (OFF(input_cond), OFF(output_cond), OFF(state_cond)));
-
-static void append_buffer(pthread_mutex_t *mutex, pthread_cond_t *cond,
- int* array_size, OMX_BUFFERHEADERTYPE **array,
- OMX_BUFFERHEADERTYPE *buffer)
-{
- pthread_mutex_lock(mutex);
- array[(*array_size)++] = buffer;
- pthread_cond_broadcast(cond);
- pthread_mutex_unlock(mutex);
-}
-
-static OMX_BUFFERHEADERTYPE *get_buffer(pthread_mutex_t *mutex, pthread_cond_t *cond,
- int* array_size, OMX_BUFFERHEADERTYPE **array,
- int wait)
-{
- OMX_BUFFERHEADERTYPE *buffer;
- pthread_mutex_lock(mutex);
- if (wait) {
- while (!*array_size)
- pthread_cond_wait(cond, mutex);
- }
- if (*array_size > 0) {
- buffer = array[0];
- (*array_size)--;
- memmove(&array[0], &array[1], (*array_size) * sizeof(OMX_BUFFERHEADERTYPE*));
- } else {
- buffer = NULL;
- }
- pthread_mutex_unlock(mutex);
- return buffer;
-}
-
-static OMX_ERRORTYPE event_handler(OMX_HANDLETYPE component, OMX_PTR app_data, OMX_EVENTTYPE event,
- OMX_U32 data1, OMX_U32 data2, OMX_PTR event_data)
-{
- OMXCodecContext *s = app_data;
- // This uses casts in the printfs, since OMX_U32 actually is a typedef for
- // unsigned long in official header versions (but there are also modified
- // versions where it is something else).
- switch (event) {
- case OMX_EventError:
- pthread_mutex_lock(&s->state_mutex);
- av_log(s->avctx, AV_LOG_ERROR, "OMX error %"PRIx32"\n", (uint32_t) data1);
- s->error = data1;
- pthread_cond_broadcast(&s->state_cond);
- pthread_mutex_unlock(&s->state_mutex);
- break;
- case OMX_EventCmdComplete:
- if (data1 == OMX_CommandStateSet) {
- pthread_mutex_lock(&s->state_mutex);
- s->state = data2;
- av_log(s->avctx, AV_LOG_VERBOSE, "OMX state changed to %"PRIu32"\n", (uint32_t) data2);
- pthread_cond_broadcast(&s->state_cond);
- pthread_mutex_unlock(&s->state_mutex);
- } else if (data1 == OMX_CommandPortDisable) {
- av_log(s->avctx, AV_LOG_VERBOSE, "OMX port %"PRIu32" disabled\n", (uint32_t) data2);
- } else if (data1 == OMX_CommandPortEnable) {
- av_log(s->avctx, AV_LOG_VERBOSE, "OMX port %"PRIu32" enabled\n", (uint32_t) data2);
- } else {
- av_log(s->avctx, AV_LOG_VERBOSE, "OMX command complete, command %"PRIu32", value %"PRIu32"\n",
- (uint32_t) data1, (uint32_t) data2);
- }
- break;
- case OMX_EventPortSettingsChanged:
- av_log(s->avctx, AV_LOG_VERBOSE, "OMX port %"PRIu32" settings changed\n", (uint32_t) data1);
- break;
- default:
- av_log(s->avctx, AV_LOG_VERBOSE, "OMX event %d %"PRIx32" %"PRIx32"\n",
- event, (uint32_t) data1, (uint32_t) data2);
- break;
- }
- return OMX_ErrorNone;
-}
-
-static OMX_ERRORTYPE empty_buffer_done(OMX_HANDLETYPE component, OMX_PTR app_data,
- OMX_BUFFERHEADERTYPE *buffer)
-{
- OMXCodecContext *s = app_data;
- if (s->input_zerocopy) {
- if (buffer->pAppPrivate) {
- if (buffer->pOutputPortPrivate)
- av_free(buffer->pAppPrivate);
- else
- av_frame_free((AVFrame**)&buffer->pAppPrivate);
- buffer->pAppPrivate = NULL;
- }
- }
- append_buffer(&s->input_mutex, &s->input_cond,
- &s->num_free_in_buffers, s->free_in_buffers, buffer);
- return OMX_ErrorNone;
-}
-
-static OMX_ERRORTYPE fill_buffer_done(OMX_HANDLETYPE component, OMX_PTR app_data,
- OMX_BUFFERHEADERTYPE *buffer)
-{
- OMXCodecContext *s = app_data;
- append_buffer(&s->output_mutex, &s->output_cond,
- &s->num_done_out_buffers, s->done_out_buffers, buffer);
- return OMX_ErrorNone;
-}
-
-static const OMX_CALLBACKTYPE callbacks = {
- event_handler,
- empty_buffer_done,
- fill_buffer_done
-};
-
-static av_cold int find_component(OMXContext *omx_context, void *logctx,
- const char *role, char *str, int str_size)
-{
- OMX_U32 i, num = 0;
- char **components;
- int ret = 0;
-
-#if CONFIG_OMX_RPI
- if (av_strstart(role, "video_encoder.", NULL)) {
- av_strlcpy(str, "OMX.broadcom.video_encode", str_size);
- return 0;
- }
-#endif
- omx_context->ptr_GetComponentsOfRole((OMX_STRING) role, &num, NULL);
- if (!num) {
- av_log(logctx, AV_LOG_WARNING, "No component for role %s found\n", role);
- return AVERROR_ENCODER_NOT_FOUND;
- }
- components = av_calloc(num, sizeof(*components));
- if (!components)
- return AVERROR(ENOMEM);
- for (i = 0; i < num; i++) {
- components[i] = av_mallocz(OMX_MAX_STRINGNAME_SIZE);
- if (!components[i]) {
- ret = AVERROR(ENOMEM);
- goto end;
- }
- }
- omx_context->ptr_GetComponentsOfRole((OMX_STRING) role, &num, (OMX_U8**) components);
- av_strlcpy(str, components[0], str_size);
-end:
- for (i = 0; i < num; i++)
- av_free(components[i]);
- av_free(components);
- return ret;
-}
-
-static av_cold int wait_for_state(OMXCodecContext *s, OMX_STATETYPE state)
-{
- int ret = 0;
- pthread_mutex_lock(&s->state_mutex);
- while (s->state != state && s->error == OMX_ErrorNone)
- pthread_cond_wait(&s->state_cond, &s->state_mutex);
- if (s->error != OMX_ErrorNone)
- ret = AVERROR_ENCODER_NOT_FOUND;
- pthread_mutex_unlock(&s->state_mutex);
- return ret;
-}
-
-static av_cold int omx_component_init(AVCodecContext *avctx, const char *role)
-{
- OMXCodecContext *s = avctx->priv_data;
- OMX_PARAM_COMPONENTROLETYPE role_params = { 0 };
- OMX_PORT_PARAM_TYPE video_port_params = { 0 };
- OMX_PARAM_PORTDEFINITIONTYPE in_port_params = { 0 }, out_port_params = { 0 };
- OMX_VIDEO_PARAM_PORTFORMATTYPE video_port_format = { 0 };
- OMX_VIDEO_PARAM_BITRATETYPE vid_param_bitrate = { 0 };
- OMX_ERRORTYPE err;
- int i;
-
- s->version.s.nVersionMajor = 1;
- s->version.s.nVersionMinor = 1;
- s->version.s.nRevision = 2;
-
- err = s->omx_context->ptr_GetHandle(&s->handle, s->component_name, s, (OMX_CALLBACKTYPE*) &callbacks);
- if (err != OMX_ErrorNone) {
- av_log(avctx, AV_LOG_ERROR, "OMX_GetHandle(%s) failed: %x\n", s->component_name, err);
- return AVERROR_UNKNOWN;
- }
-
- // This one crashes the mediaserver on qcom, if used over IOMX
- INIT_STRUCT(role_params);
- av_strlcpy(role_params.cRole, role, sizeof(role_params.cRole));
- // Intentionally ignore errors on this one
- OMX_SetParameter(s->handle, OMX_IndexParamStandardComponentRole, &role_params);
-
- INIT_STRUCT(video_port_params);
- err = OMX_GetParameter(s->handle, OMX_IndexParamVideoInit, &video_port_params);
- CHECK(err);
-
- s->in_port = s->out_port = -1;
- for (i = 0; i < video_port_params.nPorts; i++) {
- int port = video_port_params.nStartPortNumber + i;
- OMX_PARAM_PORTDEFINITIONTYPE port_params = { 0 };
- INIT_STRUCT(port_params);
- port_params.nPortIndex = port;
- err = OMX_GetParameter(s->handle, OMX_IndexParamPortDefinition, &port_params);
- if (err != OMX_ErrorNone) {
- av_log(avctx, AV_LOG_WARNING, "port %d error %x\n", port, err);
- break;
- }
- if (port_params.eDir == OMX_DirInput && s->in_port < 0) {
- in_port_params = port_params;
- s->in_port = port;
- } else if (port_params.eDir == OMX_DirOutput && s->out_port < 0) {
- out_port_params = port_params;
- s->out_port = port;
- }
- }
- if (s->in_port < 0 || s->out_port < 0) {
- av_log(avctx, AV_LOG_ERROR, "No in or out port found (in %d out %d)\n", s->in_port, s->out_port);
- return AVERROR_UNKNOWN;
- }
-
- s->color_format = 0;
- for (i = 0; ; i++) {
- INIT_STRUCT(video_port_format);
- video_port_format.nIndex = i;
- video_port_format.nPortIndex = s->in_port;
- if (OMX_GetParameter(s->handle, OMX_IndexParamVideoPortFormat, &video_port_format) != OMX_ErrorNone)
- break;
- if (video_port_format.eColorFormat == OMX_COLOR_FormatYUV420Planar ||
- video_port_format.eColorFormat == OMX_COLOR_FormatYUV420PackedPlanar) {
- s->color_format = video_port_format.eColorFormat;
- break;
- }
- }
- if (s->color_format == 0) {
- av_log(avctx, AV_LOG_ERROR, "No supported pixel formats (%d formats available)\n", i);
- return AVERROR_UNKNOWN;
- }
-
- in_port_params.bEnabled = OMX_TRUE;
- in_port_params.bPopulated = OMX_FALSE;
- in_port_params.eDomain = OMX_PortDomainVideo;
-
- in_port_params.format.video.pNativeRender = NULL;
- in_port_params.format.video.bFlagErrorConcealment = OMX_FALSE;
- in_port_params.format.video.eColorFormat = s->color_format;
- s->stride = avctx->width;
- s->plane_size = avctx->height;
- // If specific codecs need to manually override the stride/plane_size,
- // that can be done here.
- in_port_params.format.video.nStride = s->stride;
- in_port_params.format.video.nSliceHeight = s->plane_size;
- in_port_params.format.video.nFrameWidth = avctx->width;
- in_port_params.format.video.nFrameHeight = avctx->height;
- if (avctx->framerate.den > 0 && avctx->framerate.num > 0)
- in_port_params.format.video.xFramerate = (1LL << 16) * avctx->framerate.num / avctx->framerate.den;
- else
- in_port_params.format.video.xFramerate = (1LL << 16) * avctx->time_base.den / avctx->time_base.num;
-
- err = OMX_SetParameter(s->handle, OMX_IndexParamPortDefinition, &in_port_params);
- CHECK(err);
- err = OMX_GetParameter(s->handle, OMX_IndexParamPortDefinition, &in_port_params);
- CHECK(err);
- s->stride = in_port_params.format.video.nStride;
- s->plane_size = in_port_params.format.video.nSliceHeight;
- s->num_in_buffers = in_port_params.nBufferCountActual;
-
- err = OMX_GetParameter(s->handle, OMX_IndexParamPortDefinition, &out_port_params);
- out_port_params.bEnabled = OMX_TRUE;
- out_port_params.bPopulated = OMX_FALSE;
- out_port_params.eDomain = OMX_PortDomainVideo;
- out_port_params.format.video.pNativeRender = NULL;
- out_port_params.format.video.nFrameWidth = avctx->width;
- out_port_params.format.video.nFrameHeight = avctx->height;
- out_port_params.format.video.nStride = 0;
- out_port_params.format.video.nSliceHeight = 0;
- out_port_params.format.video.nBitrate = avctx->bit_rate;
- out_port_params.format.video.xFramerate = in_port_params.format.video.xFramerate;
- out_port_params.format.video.bFlagErrorConcealment = OMX_FALSE;
- if (avctx->codec->id == AV_CODEC_ID_MPEG4)
- out_port_params.format.video.eCompressionFormat = OMX_VIDEO_CodingMPEG4;
- else if (avctx->codec->id == AV_CODEC_ID_H264)
- out_port_params.format.video.eCompressionFormat = OMX_VIDEO_CodingAVC;
-
- err = OMX_SetParameter(s->handle, OMX_IndexParamPortDefinition, &out_port_params);
- CHECK(err);
- err = OMX_GetParameter(s->handle, OMX_IndexParamPortDefinition, &out_port_params);
- CHECK(err);
- s->num_out_buffers = out_port_params.nBufferCountActual;
-
- INIT_STRUCT(vid_param_bitrate);
- vid_param_bitrate.nPortIndex = s->out_port;
- vid_param_bitrate.eControlRate = OMX_Video_ControlRateVariable;
- vid_param_bitrate.nTargetBitrate = avctx->bit_rate;
- err = OMX_SetParameter(s->handle, OMX_IndexParamVideoBitrate, &vid_param_bitrate);
- if (err != OMX_ErrorNone)
- av_log(avctx, AV_LOG_WARNING, "Unable to set video bitrate parameter\n");
-
- if (avctx->codec->id == AV_CODEC_ID_H264) {
- OMX_VIDEO_PARAM_AVCTYPE avc = { 0 };
- INIT_STRUCT(avc);
- avc.nPortIndex = s->out_port;
- err = OMX_GetParameter(s->handle, OMX_IndexParamVideoAvc, &avc);
- CHECK(err);
- avc.nBFrames = 0;
- avc.nPFrames = avctx->gop_size - 1;
- switch (s->profile == AV_PROFILE_UNKNOWN ? avctx->profile : s->profile) {
- case AV_PROFILE_H264_BASELINE:
- avc.eProfile = OMX_VIDEO_AVCProfileBaseline;
- break;
- case AV_PROFILE_H264_MAIN:
- avc.eProfile = OMX_VIDEO_AVCProfileMain;
- break;
- case AV_PROFILE_H264_HIGH:
- avc.eProfile = OMX_VIDEO_AVCProfileHigh;
- break;
- default:
- break;
- }
- err = OMX_SetParameter(s->handle, OMX_IndexParamVideoAvc, &avc);
- CHECK(err);
- }
-
- err = OMX_SendCommand(s->handle, OMX_CommandStateSet, OMX_StateIdle, NULL);
- CHECK(err);
-
- s->in_buffer_headers = av_mallocz(sizeof(OMX_BUFFERHEADERTYPE*) * s->num_in_buffers);
- s->free_in_buffers = av_mallocz(sizeof(OMX_BUFFERHEADERTYPE*) * s->num_in_buffers);
- s->out_buffer_headers = av_mallocz(sizeof(OMX_BUFFERHEADERTYPE*) * s->num_out_buffers);
- s->done_out_buffers = av_mallocz(sizeof(OMX_BUFFERHEADERTYPE*) * s->num_out_buffers);
- if (!s->in_buffer_headers || !s->free_in_buffers || !s->out_buffer_headers || !s->done_out_buffers)
- return AVERROR(ENOMEM);
- for (i = 0; i < s->num_in_buffers && err == OMX_ErrorNone; i++) {
- if (s->input_zerocopy)
- err = OMX_UseBuffer(s->handle, &s->in_buffer_headers[i], s->in_port, s, in_port_params.nBufferSize, NULL);
- else
- err = OMX_AllocateBuffer(s->handle, &s->in_buffer_headers[i], s->in_port, s, in_port_params.nBufferSize);
- if (err == OMX_ErrorNone)
- s->in_buffer_headers[i]->pAppPrivate = s->in_buffer_headers[i]->pOutputPortPrivate = NULL;
- }
- CHECK(err);
- s->num_in_buffers = i;
- for (i = 0; i < s->num_out_buffers && err == OMX_ErrorNone; i++)
- err = OMX_AllocateBuffer(s->handle, &s->out_buffer_headers[i], s->out_port, s, out_port_params.nBufferSize);
- CHECK(err);
- s->num_out_buffers = i;
-
- if (wait_for_state(s, OMX_StateIdle) < 0) {
- av_log(avctx, AV_LOG_ERROR, "Didn't get OMX_StateIdle\n");
- return AVERROR_UNKNOWN;
- }
- err = OMX_SendCommand(s->handle, OMX_CommandStateSet, OMX_StateExecuting, NULL);
- CHECK(err);
- if (wait_for_state(s, OMX_StateExecuting) < 0) {
- av_log(avctx, AV_LOG_ERROR, "Didn't get OMX_StateExecuting\n");
- return AVERROR_UNKNOWN;
- }
-
- for (i = 0; i < s->num_out_buffers && err == OMX_ErrorNone; i++)
- err = OMX_FillThisBuffer(s->handle, s->out_buffer_headers[i]);
- if (err != OMX_ErrorNone) {
- for (; i < s->num_out_buffers; i++)
- s->done_out_buffers[s->num_done_out_buffers++] = s->out_buffer_headers[i];
- }
- for (i = 0; i < s->num_in_buffers; i++)
- s->free_in_buffers[s->num_free_in_buffers++] = s->in_buffer_headers[i];
- return err != OMX_ErrorNone ? AVERROR_UNKNOWN : 0;
-}
-
-static av_cold void cleanup(OMXCodecContext *s)
-{
- int executing;
-
- /* If the mutexes/condition variables have not been properly initialized,
- * nothing has been initialized and locking the mutex might be unsafe. */
- if (s->mutex_cond_inited_cnt == NB_MUTEX_CONDS) {
- pthread_mutex_lock(&s->state_mutex);
- executing = s->state == OMX_StateExecuting;
- pthread_mutex_unlock(&s->state_mutex);
-
- if (executing) {
- OMX_SendCommand(s->handle, OMX_CommandStateSet, OMX_StateIdle, NULL);
- wait_for_state(s, OMX_StateIdle);
- OMX_SendCommand(s->handle, OMX_CommandStateSet, OMX_StateLoaded, NULL);
- for (int i = 0; i < s->num_in_buffers; i++) {
- OMX_BUFFERHEADERTYPE *buffer = get_buffer(&s->input_mutex, &s->input_cond,
- &s->num_free_in_buffers, s->free_in_buffers, 1);
- if (s->input_zerocopy)
- buffer->pBuffer = NULL;
- OMX_FreeBuffer(s->handle, s->in_port, buffer);
- }
- for (int i = 0; i < s->num_out_buffers; i++) {
- OMX_BUFFERHEADERTYPE *buffer = get_buffer(&s->output_mutex, &s->output_cond,
- &s->num_done_out_buffers, s->done_out_buffers, 1);
- OMX_FreeBuffer(s->handle, s->out_port, buffer);
- }
- wait_for_state(s, OMX_StateLoaded);
- }
- if (s->handle) {
- s->omx_context->ptr_FreeHandle(s->handle);
- s->handle = NULL;
- }
-
- omx_deinit(s->omx_context);
- s->omx_context = NULL;
- av_freep(&s->in_buffer_headers);
- av_freep(&s->out_buffer_headers);
- av_freep(&s->free_in_buffers);
- av_freep(&s->done_out_buffers);
- av_freep(&s->output_buf);
- }
- ff_pthread_free(s, omx_codec_context_offsets);
-}
-
-static av_cold int omx_encode_init(AVCodecContext *avctx)
-{
- OMXCodecContext *s = avctx->priv_data;
- int ret = AVERROR_ENCODER_NOT_FOUND;
- const char *role;
- OMX_BUFFERHEADERTYPE *buffer;
- OMX_ERRORTYPE err;
-
- av_log(avctx, AV_LOG_WARNING,
- "The %s encoder is deprecated and will be removed in future versions\n",
- avctx->codec->name);
-
- /* cleanup relies on the mutexes/conditions being initialized first. */
- ret = ff_pthread_init(s, omx_codec_context_offsets);
- if (ret < 0)
- return ret;
- s->omx_context = omx_init(avctx, s->libname, s->libprefix);
- if (!s->omx_context)
- return AVERROR_ENCODER_NOT_FOUND;
-
- s->avctx = avctx;
- s->state = OMX_StateLoaded;
- s->error = OMX_ErrorNone;
-
- switch (avctx->codec->id) {
- case AV_CODEC_ID_MPEG4:
- role = "video_encoder.mpeg4";
- break;
- case AV_CODEC_ID_H264:
- role = "video_encoder.avc";
- break;
- default:
- return AVERROR(ENOSYS);
- }
-
- if ((ret = find_component(s->omx_context, avctx, role, s->component_name, sizeof(s->component_name))) < 0)
- goto fail;
-
- av_log(avctx, AV_LOG_INFO, "Using %s\n", s->component_name);
-
- if ((ret = omx_component_init(avctx, role)) < 0)
- goto fail;
-
- if (avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER) {
- while (1) {
- buffer = get_buffer(&s->output_mutex, &s->output_cond,
- &s->num_done_out_buffers, s->done_out_buffers, 1);
- if (buffer->nFlags & OMX_BUFFERFLAG_CODECCONFIG) {
- if (buffer->nFilledLen > INT32_MAX - AV_INPUT_BUFFER_PADDING_SIZE - avctx->extradata_size) {
- ret = AVERROR(ENOMEM);
- goto fail;
- }
-
- if ((ret = av_reallocp(&avctx->extradata, avctx->extradata_size + buffer->nFilledLen + AV_INPUT_BUFFER_PADDING_SIZE)) < 0) {
- avctx->extradata_size = 0;
- goto fail;
- }
- memcpy(avctx->extradata + avctx->extradata_size, buffer->pBuffer + buffer->nOffset, buffer->nFilledLen);
- avctx->extradata_size += buffer->nFilledLen;
- memset(avctx->extradata + avctx->extradata_size, 0, AV_INPUT_BUFFER_PADDING_SIZE);
- }
- err = OMX_FillThisBuffer(s->handle, buffer);
- if (err != OMX_ErrorNone) {
- append_buffer(&s->output_mutex, &s->output_cond,
- &s->num_done_out_buffers, s->done_out_buffers, buffer);
- av_log(avctx, AV_LOG_ERROR, "OMX_FillThisBuffer failed: %x\n", err);
- ret = AVERROR_UNKNOWN;
- goto fail;
- }
- if (avctx->codec->id == AV_CODEC_ID_H264) {
- // For H.264, the extradata can be returned in two separate buffers
- // (the videocore encoder on raspberry pi does this);
- // therefore check that we have got both SPS and PPS before continuing.
- int nals[32] = { 0 };
- int i;
- for (i = 0; i + 4 < avctx->extradata_size; i++) {
- if (!avctx->extradata[i + 0] &&
- !avctx->extradata[i + 1] &&
- !avctx->extradata[i + 2] &&
- avctx->extradata[i + 3] == 1) {
- nals[avctx->extradata[i + 4] & 0x1f]++;
- }
- }
- if (nals[H264_NAL_SPS] && nals[H264_NAL_PPS])
- break;
- } else {
- if (avctx->extradata_size > 0)
- break;
- }
- }
- }
-
- return 0;
-fail:
- return ret;
-}
-
-
-static int omx_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
- const AVFrame *frame, int *got_packet)
-{
- OMXCodecContext *s = avctx->priv_data;
- int ret = 0;
- OMX_BUFFERHEADERTYPE* buffer;
- OMX_ERRORTYPE err;
- int had_partial = 0;
-
- if (frame) {
- uint8_t *dst[4];
- int linesize[4];
- int need_copy;
- buffer = get_buffer(&s->input_mutex, &s->input_cond,
- &s->num_free_in_buffers, s->free_in_buffers, 1);
-
- buffer->nFilledLen = av_image_fill_arrays(dst, linesize, buffer->pBuffer, avctx->pix_fmt, s->stride, s->plane_size, 1);
-
- if (s->input_zerocopy) {
- uint8_t *src[4] = { NULL };
- int src_linesize[4];
- av_image_fill_arrays(src, src_linesize, frame->data[0], avctx->pix_fmt, s->stride, s->plane_size, 1);
- if (frame->linesize[0] == src_linesize[0] &&
- frame->linesize[1] == src_linesize[1] &&
- frame->linesize[2] == src_linesize[2] &&
- frame->data[1] == src[1] &&
- frame->data[2] == src[2]) {
- // If the input frame happens to have all planes stored contiguously,
- // with the right strides, just clone the frame and set the OMX
- // buffer header to point to it
- AVFrame *local = av_frame_clone(frame);
- if (!local) {
- // Return the buffer to the queue so it's not lost
- append_buffer(&s->input_mutex, &s->input_cond, &s->num_free_in_buffers, s->free_in_buffers, buffer);
- return AVERROR(ENOMEM);
- } else {
- buffer->pAppPrivate = local;
- buffer->pOutputPortPrivate = NULL;
- buffer->pBuffer = local->data[0];
- need_copy = 0;
- }
- } else {
- // If not, we need to allocate a new buffer with the right
- // size and copy the input frame into it.
- uint8_t *buf = NULL;
- int image_buffer_size = av_image_get_buffer_size(avctx->pix_fmt, s->stride, s->plane_size, 1);
- if (image_buffer_size >= 0)
- buf = av_malloc(image_buffer_size);
- if (!buf) {
- // Return the buffer to the queue so it's not lost
- append_buffer(&s->input_mutex, &s->input_cond, &s->num_free_in_buffers, s->free_in_buffers, buffer);
- return AVERROR(ENOMEM);
- } else {
- buffer->pAppPrivate = buf;
- // Mark that pAppPrivate is an av_malloc'ed buffer, not an AVFrame
- buffer->pOutputPortPrivate = (void*) 1;
- buffer->pBuffer = buf;
- need_copy = 1;
- buffer->nFilledLen = av_image_fill_arrays(dst, linesize, buffer->pBuffer, avctx->pix_fmt, s->stride, s->plane_size, 1);
- }
- }
- } else {
- need_copy = 1;
- }
- if (need_copy)
- av_image_copy2(dst, linesize, frame->data, frame->linesize,
- avctx->pix_fmt, avctx->width, avctx->height);
- buffer->nFlags = OMX_BUFFERFLAG_ENDOFFRAME;
- buffer->nOffset = 0;
- // Convert the timestamps to microseconds; some encoders can ignore
- // the framerate and do VFR bit allocation based on timestamps.
- buffer->nTimeStamp = to_omx_ticks(av_rescale_q(frame->pts, avctx->time_base, AV_TIME_BASE_Q));
- if (frame->pict_type == AV_PICTURE_TYPE_I) {
-#if CONFIG_OMX_RPI
- OMX_CONFIG_BOOLEANTYPE config = {0, };
- INIT_STRUCT(config);
- config.bEnabled = OMX_TRUE;
- err = OMX_SetConfig(s->handle, OMX_IndexConfigBrcmVideoRequestIFrame, &config);
- if (err != OMX_ErrorNone) {
- av_log(avctx, AV_LOG_ERROR, "OMX_SetConfig(RequestIFrame) failed: %x\n", err);
- }
-#else
- OMX_CONFIG_INTRAREFRESHVOPTYPE config = {0, };
- INIT_STRUCT(config);
- config.nPortIndex = s->out_port;
- config.IntraRefreshVOP = OMX_TRUE;
- err = OMX_SetConfig(s->handle, OMX_IndexConfigVideoIntraVOPRefresh, &config);
- if (err != OMX_ErrorNone) {
- av_log(avctx, AV_LOG_ERROR, "OMX_SetConfig(IntraVOPRefresh) failed: %x\n", err);
- }
-#endif
- }
- err = OMX_EmptyThisBuffer(s->handle, buffer);
- if (err != OMX_ErrorNone) {
- append_buffer(&s->input_mutex, &s->input_cond, &s->num_free_in_buffers, s->free_in_buffers, buffer);
- av_log(avctx, AV_LOG_ERROR, "OMX_EmptyThisBuffer failed: %x\n", err);
- return AVERROR_UNKNOWN;
- }
- } else if (!s->eos_sent) {
- buffer = get_buffer(&s->input_mutex, &s->input_cond,
- &s->num_free_in_buffers, s->free_in_buffers, 1);
-
- buffer->nFilledLen = 0;
- buffer->nFlags = OMX_BUFFERFLAG_EOS;
- buffer->pAppPrivate = buffer->pOutputPortPrivate = NULL;
- err = OMX_EmptyThisBuffer(s->handle, buffer);
- if (err != OMX_ErrorNone) {
- append_buffer(&s->input_mutex, &s->input_cond, &s->num_free_in_buffers, s->free_in_buffers, buffer);
- av_log(avctx, AV_LOG_ERROR, "OMX_EmptyThisBuffer failed: %x\n", err);
- return AVERROR_UNKNOWN;
- }
- s->eos_sent = 1;
- }
-
- while (!*got_packet && ret == 0 && !s->got_eos) {
- // If not flushing, just poll the queue if there's finished packets.
- // If flushing, do a blocking wait until we either get a completed
- // packet, or get EOS.
- buffer = get_buffer(&s->output_mutex, &s->output_cond,
- &s->num_done_out_buffers, s->done_out_buffers,
- !frame || had_partial);
- if (!buffer)
- break;
-
- if (buffer->nFlags & OMX_BUFFERFLAG_EOS)
- s->got_eos = 1;
-
- if (buffer->nFlags & OMX_BUFFERFLAG_CODECCONFIG && avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER) {
- if ((ret = av_reallocp(&avctx->extradata, avctx->extradata_size + buffer->nFilledLen + AV_INPUT_BUFFER_PADDING_SIZE)) < 0) {
- avctx->extradata_size = 0;
- goto end;
- }
- memcpy(avctx->extradata + avctx->extradata_size, buffer->pBuffer + buffer->nOffset, buffer->nFilledLen);
- avctx->extradata_size += buffer->nFilledLen;
- memset(avctx->extradata + avctx->extradata_size, 0, AV_INPUT_BUFFER_PADDING_SIZE);
- } else {
- int newsize = s->output_buf_size + buffer->nFilledLen + AV_INPUT_BUFFER_PADDING_SIZE;
- if ((ret = av_reallocp(&s->output_buf, newsize)) < 0) {
- s->output_buf_size = 0;
- goto end;
- }
- memcpy(s->output_buf + s->output_buf_size, buffer->pBuffer + buffer->nOffset, buffer->nFilledLen);
- s->output_buf_size += buffer->nFilledLen;
- if (buffer->nFlags & OMX_BUFFERFLAG_ENDOFFRAME) {
- memset(s->output_buf + s->output_buf_size, 0, AV_INPUT_BUFFER_PADDING_SIZE);
- if ((ret = av_packet_from_data(pkt, s->output_buf, s->output_buf_size)) < 0) {
- av_freep(&s->output_buf);
- s->output_buf_size = 0;
- goto end;
- }
- s->output_buf = NULL;
- s->output_buf_size = 0;
- pkt->pts = av_rescale_q(from_omx_ticks(buffer->nTimeStamp), AV_TIME_BASE_Q, avctx->time_base);
- // We don't currently enable B-frames for the encoders, so set
- // pkt->dts = pkt->pts. (The calling code behaves worse if the encoder
- // doesn't set the dts).
- pkt->dts = pkt->pts;
- if (buffer->nFlags & OMX_BUFFERFLAG_SYNCFRAME)
- pkt->flags |= AV_PKT_FLAG_KEY;
- *got_packet = 1;
- } else {
-#if CONFIG_OMX_RPI
- had_partial = 1;
-#endif
- }
- }
-end:
- err = OMX_FillThisBuffer(s->handle, buffer);
- if (err != OMX_ErrorNone) {
- append_buffer(&s->output_mutex, &s->output_cond, &s->num_done_out_buffers, s->done_out_buffers, buffer);
- av_log(avctx, AV_LOG_ERROR, "OMX_FillThisBuffer failed: %x\n", err);
- ret = AVERROR_UNKNOWN;
- }
- }
- return ret;
-}
-
-static av_cold int omx_encode_end(AVCodecContext *avctx)
-{
- OMXCodecContext *s = avctx->priv_data;
-
- cleanup(s);
- return 0;
-}
-
-#define OFFSET(x) offsetof(OMXCodecContext, x)
-#define VDE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_ENCODING_PARAM
-#define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
-static const AVOption options[] = {
- { "omx_libname", "OpenMAX library name", OFFSET(libname), AV_OPT_TYPE_STRING, { 0 }, 0, 0, VDE },
- { "omx_libprefix", "OpenMAX library prefix", OFFSET(libprefix), AV_OPT_TYPE_STRING, { 0 }, 0, 0, VDE },
- { "zerocopy", "Try to avoid copying input frames if possible", OFFSET(input_zerocopy), AV_OPT_TYPE_INT, { .i64 = CONFIG_OMX_RPI }, 0, 1, VE },
- { "profile", "Set the encoding profile", OFFSET(profile), AV_OPT_TYPE_INT, { .i64 = AV_PROFILE_UNKNOWN }, AV_PROFILE_UNKNOWN, AV_PROFILE_H264_HIGH, VE, .unit = "profile" },
- { "baseline", "", 0, AV_OPT_TYPE_CONST, { .i64 = AV_PROFILE_H264_BASELINE }, 0, 0, VE, .unit = "profile" },
- { "main", "", 0, AV_OPT_TYPE_CONST, { .i64 = AV_PROFILE_H264_MAIN }, 0, 0, VE, .unit = "profile" },
- { "high", "", 0, AV_OPT_TYPE_CONST, { .i64 = AV_PROFILE_H264_HIGH }, 0, 0, VE, .unit = "profile" },
- { NULL }
-};
-
-static const enum AVPixelFormat omx_encoder_pix_fmts[] = {
- AV_PIX_FMT_YUV420P, AV_PIX_FMT_NONE
-};
-
-static const AVClass omx_mpeg4enc_class = {
- .class_name = "mpeg4_omx",
- .item_name = av_default_item_name,
- .option = options,
- .version = LIBAVUTIL_VERSION_INT,
-};
-const FFCodec ff_mpeg4_omx_encoder = {
- .p.name = "mpeg4_omx",
- CODEC_LONG_NAME("OpenMAX IL MPEG-4 video encoder"),
- .p.type = AVMEDIA_TYPE_VIDEO,
- .p.id = AV_CODEC_ID_MPEG4,
- .priv_data_size = sizeof(OMXCodecContext),
- .init = omx_encode_init,
- FF_CODEC_ENCODE_CB(omx_encode_frame),
- .close = omx_encode_end,
- CODEC_PIXFMTS_ARRAY(omx_encoder_pix_fmts),
- .color_ranges = AVCOL_RANGE_MPEG,
- .p.capabilities = AV_CODEC_CAP_DELAY,
- .caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
- .p.priv_class = &omx_mpeg4enc_class,
-};
-
-static const AVClass omx_h264enc_class = {
- .class_name = "h264_omx",
- .item_name = av_default_item_name,
- .option = options,
- .version = LIBAVUTIL_VERSION_INT,
-};
-const FFCodec ff_h264_omx_encoder = {
- .p.name = "h264_omx",
- CODEC_LONG_NAME("OpenMAX IL H.264 video encoder"),
- .p.type = AVMEDIA_TYPE_VIDEO,
- .p.id = AV_CODEC_ID_H264,
- .priv_data_size = sizeof(OMXCodecContext),
- .init = omx_encode_init,
- FF_CODEC_ENCODE_CB(omx_encode_frame),
- .close = omx_encode_end,
- CODEC_PIXFMTS_ARRAY(omx_encoder_pix_fmts),
- .color_ranges = AVCOL_RANGE_MPEG, /* FIXME: implement tagging */
- .p.capabilities = AV_CODEC_CAP_DELAY,
- .caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
- .p.priv_class = &omx_h264enc_class,
-};
diff --git a/libavcodec/version_major.h b/libavcodec/version_major.h
index 52f6d629dd..70acd5d655 100644
--- a/libavcodec/version_major.h
+++ b/libavcodec/version_major.h
@@ -50,9 +50,6 @@
#define FF_API_PARSER_CODECID (LIBAVCODEC_VERSION_MAJOR < 63)
#define FF_API_MJPEG_EXTERN_HUFF (LIBAVCODEC_VERSION_MAJOR < 63)
-
-// reminder to remove the OMX encoder on next major bump
-#define FF_CODEC_OMX (LIBAVCODEC_VERSION_MAJOR < 63)
// reminder to remove Sonic Lossy/Lossless encoders on next major bump
#define FF_CODEC_SONIC_ENC (LIBAVCODEC_VERSION_MAJOR < 63)
// reminder to remove Sonic decoder on next-next major bump
--
2.52.0
From d4aff3ba45ba078421c2218da65eebaa9a5b2908 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
Date: Sun, 8 Mar 2026 20:48:00 +0100
Subject: [PATCH 09/33] avcodec: Remove FF_API_PARSER_CODECID
The parser API was scheduled to use enum AVCodecID
in commit 8a322c956f3808a7199aef9b63a187af17c0a372
on 2025-11-01. The switch is made now despite this
being fairly recently because it involves no deprecation
and therefore no change from our downstreams at all.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
---
libavcodec/avcodec.h | 8 --------
libavcodec/parser.c | 4 ----
libavcodec/parser_internal.h | 4 ----
libavcodec/version_major.h | 1 -
4 files changed, 17 deletions(-)
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 11ee76efd9..5f7ee31f0d 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -2761,11 +2761,7 @@ typedef struct AVCodecParserContext {
} AVCodecParserContext;
typedef struct AVCodecParser {
-#if FF_API_PARSER_CODECID
- int codec_ids[7]; /* several codec IDs are permitted */
-#else
enum AVCodecID codec_ids[7]; /* several codec IDs are permitted */
-#endif
#if FF_API_PARSER_PRIVATE
/*****************************************************************
* All fields below this line are not part of the public API. They
@@ -2803,11 +2799,7 @@ typedef struct AVCodecParser {
*/
const AVCodecParser *av_parser_iterate(void **opaque);
-#if FF_API_PARSER_CODECID
-AVCodecParserContext *av_parser_init(int codec_id);
-#else
AVCodecParserContext *av_parser_init(enum AVCodecID codec_id);
-#endif
/**
* Parse a packet.
diff --git a/libavcodec/parser.c b/libavcodec/parser.c
index 28f4de5826..cf5d65ee16 100644
--- a/libavcodec/parser.c
+++ b/libavcodec/parser.c
@@ -32,11 +32,7 @@
#include "parser.h"
#include "parser_internal.h"
-#if FF_API_PARSER_CODECID
-av_cold AVCodecParserContext *av_parser_init(int codec_id)
-#else
av_cold AVCodecParserContext *av_parser_init(enum AVCodecID codec_id)
-#endif
{
AVCodecParserContext *s = NULL;
const AVCodecParser *parser;
diff --git a/libavcodec/parser_internal.h b/libavcodec/parser_internal.h
index fa9af971c1..aad1fe1146 100644
--- a/libavcodec/parser_internal.h
+++ b/libavcodec/parser_internal.h
@@ -28,11 +28,7 @@
#if FF_API_PARSER_PRIVATE
typedef union FFCodecParser {
struct {
-#if FF_API_PARSER_CODECID
- int codec_ids[7]; /* several codec IDs are permitted */
-#else
enum AVCodecID codec_ids[7]; /* several codec IDs are permitted */
-#endif
int priv_data_size;
int (*init)(AVCodecParserContext *s);
int (*parse)(AVCodecParserContext *s,
diff --git a/libavcodec/version_major.h b/libavcodec/version_major.h
index 70acd5d655..93e251546a 100644
--- a/libavcodec/version_major.h
+++ b/libavcodec/version_major.h
@@ -47,7 +47,6 @@
#define FF_API_NVDEC_OLD_PIX_FMTS (LIBAVCODEC_VERSION_MAJOR < 63)
#define FF_API_PARSER_PRIVATE (LIBAVCODEC_VERSION_MAJOR < 63)
-#define FF_API_PARSER_CODECID (LIBAVCODEC_VERSION_MAJOR < 63)
#define FF_API_MJPEG_EXTERN_HUFF (LIBAVCODEC_VERSION_MAJOR < 63)
// reminder to remove Sonic Lossy/Lossless encoders on next major bump
--
2.52.0
From 00d8b28c60ba49e08b3df9691c3a024494c5f748 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
Date: Sun, 8 Mar 2026 21:00:04 +0100
Subject: [PATCH 10/33] avcodec: Remove FF_API_PARSER_PRIVATE
Deprecated on 2025-11-01. It is removed right now despite
this being fairly recently, because users never had
a legitimate reason to touch these fields at all:
After all, their meaning was entirely undocumented.
Furthermore, the split callback is unset for any parser
since commit e5af9203098a889f36b759652615046254d45102 from 2021.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
---
libavcodec/avcodec.h | 24 ------------------------
libavcodec/parser_internal.h | 22 ----------------------
libavcodec/parsers.c | 16 ----------------
libavcodec/version_major.h | 2 --
4 files changed, 64 deletions(-)
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 5f7ee31f0d..f45e8d8baa 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -2762,30 +2762,6 @@ typedef struct AVCodecParserContext {
typedef struct AVCodecParser {
enum AVCodecID codec_ids[7]; /* several codec IDs are permitted */
-#if FF_API_PARSER_PRIVATE
- /*****************************************************************
- * All fields below this line are not part of the public API. They
- * may not be used outside of libavcodec and can be changed and
- * removed at will.
- * New public fields should be added right above.
- *****************************************************************
- */
- attribute_deprecated
- int priv_data_size;
- attribute_deprecated
- int (*parser_init)(AVCodecParserContext *s);
- /* This callback never returns an error, a negative value means that
- * the frame start was in a previous packet. */
- attribute_deprecated
- int (*parser_parse)(AVCodecParserContext *s,
- AVCodecContext *avctx,
- const uint8_t **poutbuf, int *poutbuf_size,
- const uint8_t *buf, int buf_size);
- attribute_deprecated
- void (*parser_close)(AVCodecParserContext *s);
- attribute_deprecated
- int (*split)(AVCodecContext *avctx, const uint8_t *buf, int buf_size);
-#endif
} AVCodecParser;
/**
diff --git a/libavcodec/parser_internal.h b/libavcodec/parser_internal.h
index aad1fe1146..d0e0c8beb5 100644
--- a/libavcodec/parser_internal.h
+++ b/libavcodec/parser_internal.h
@@ -23,23 +23,7 @@
#include "libavutil/macros.h"
#include "avcodec.h"
-#include "codec_id.h"
-#if FF_API_PARSER_PRIVATE
-typedef union FFCodecParser {
- struct {
- enum AVCodecID codec_ids[7]; /* several codec IDs are permitted */
- int priv_data_size;
- int (*init)(AVCodecParserContext *s);
- int (*parse)(AVCodecParserContext *s,
- AVCodecContext *avctx,
- const uint8_t **poutbuf, int *poutbuf_size,
- const uint8_t *buf, int buf_size);
- void (*close)(AVCodecParserContext *s);
- int (*split)(AVCodecContext *avctx, const uint8_t *buf, int buf_size);
- };
- AVCodecParser p;
-#else
typedef struct FFCodecParser {
AVCodecParser p;
unsigned priv_data_size;
@@ -49,7 +33,6 @@ typedef struct FFCodecParser {
const uint8_t **poutbuf, int *poutbuf_size,
const uint8_t *buf, int buf_size);
void (*close)(AVCodecParserContext *s);
-#endif
} FFCodecParser;
static inline const FFCodecParser *ffcodecparser(const AVCodecParser *parser)
@@ -68,12 +51,7 @@ static inline const FFCodecParser *ffcodecparser(const AVCodecParser *parser)
#define FIRST_SEVEN(...) FF_MSVC_EXPAND(FIRST_SEVEN2(__VA_ARGS__))
#define TIMES_SEVEN(a) a,a,a,a,a,a,a
-#if FF_API_PARSER_PRIVATE
-#define PARSER_CODEC_LIST(...) CHECK_FOR_TOO_MANY_IDS(__VA_ARGS__) \
- .codec_ids = { FIRST_SEVEN(__VA_ARGS__, TIMES_SEVEN(AV_CODEC_ID_NONE)) }
-#else
#define PARSER_CODEC_LIST(...) CHECK_FOR_TOO_MANY_IDS(__VA_ARGS__) \
.p.codec_ids = { FIRST_SEVEN(__VA_ARGS__, TIMES_SEVEN(AV_CODEC_ID_NONE)) }
-#endif
#endif /* AVCODEC_PARSER_INTERNAL_H */
diff --git a/libavcodec/parsers.c b/libavcodec/parsers.c
index 162b96cb69..b54442a0ea 100644
--- a/libavcodec/parsers.c
+++ b/libavcodec/parsers.c
@@ -21,22 +21,6 @@
#include "avcodec.h"
#include "parser_internal.h"
-#if FF_API_PARSER_PRIVATE
-#include "libavutil/internal.h"
-#include <assert.h>
-#include <stddef.h>
-
-FF_DISABLE_DEPRECATION_WARNINGS
-#define CHECK_OFFSET(field, public_prefix) static_assert(offsetof(FFCodecParser, field) == offsetof(FFCodecParser, p.public_prefix ## field), "Wrong offsets")
-CHECK_OFFSET(codec_ids,);
-CHECK_OFFSET(priv_data_size,);
-CHECK_OFFSET(init, parser_);
-CHECK_OFFSET(parse, parser_);
-CHECK_OFFSET(close, parser_);
-CHECK_OFFSET(split,);
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif
-
extern const FFCodecParser ff_aac_parser;
extern const FFCodecParser ff_aac_latm_parser;
extern const FFCodecParser ff_ac3_parser;
diff --git a/libavcodec/version_major.h b/libavcodec/version_major.h
index 93e251546a..a0232c8fe2 100644
--- a/libavcodec/version_major.h
+++ b/libavcodec/version_major.h
@@ -46,8 +46,6 @@
#define FF_API_NVDEC_OLD_PIX_FMTS (LIBAVCODEC_VERSION_MAJOR < 63)
-#define FF_API_PARSER_PRIVATE (LIBAVCODEC_VERSION_MAJOR < 63)
-
#define FF_API_MJPEG_EXTERN_HUFF (LIBAVCODEC_VERSION_MAJOR < 63)
// reminder to remove Sonic Lossy/Lossless encoders on next major bump
#define FF_CODEC_SONIC_ENC (LIBAVCODEC_VERSION_MAJOR < 63)
--
2.52.0
From 0565acca3c5e57bb86d9bbc135c76ed820eda769 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
Date: Sun, 8 Mar 2026 21:11:08 +0100
Subject: [PATCH 11/33] avcodec: Remove FF_API_NVDEC_OLD_PIX_FMTS
The switch to the new pixel formats was announced
on 2025-07-11.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
---
libavcodec/cuviddec.c | 28 ----------------------------
libavcodec/nvdec.c | 16 ----------------
libavcodec/version_major.h | 3 ---
3 files changed, 47 deletions(-)
diff --git a/libavcodec/cuviddec.c b/libavcodec/cuviddec.c
index 10e4cb3e21..d423d2611b 100644
--- a/libavcodec/cuviddec.c
+++ b/libavcodec/cuviddec.c
@@ -199,18 +199,10 @@ static int CUDAAPI cuvid_handle_video_sequence(void *opaque, CUVIDEOFORMAT* form
break;
case 2: // 10-bit
if (chroma_444) {
-#if FF_API_NVDEC_OLD_PIX_FMTS
- pix_fmts[1] = AV_PIX_FMT_YUV444P16;
-#else
pix_fmts[1] = AV_PIX_FMT_YUV444P10MSB;
-#endif
#ifdef NVDEC_HAVE_422_SUPPORT
} else if (format->chroma_format == cudaVideoChromaFormat_422) {
-#if FF_API_NVDEC_OLD_PIX_FMTS
- pix_fmts[1] = AV_PIX_FMT_P216;
-#else
pix_fmts[1] = AV_PIX_FMT_P210;
-#endif
#endif
} else {
pix_fmts[1] = AV_PIX_FMT_P010;
@@ -219,25 +211,13 @@ static int CUDAAPI cuvid_handle_video_sequence(void *opaque, CUVIDEOFORMAT* form
break;
case 4: // 12-bit
if (chroma_444) {
-#if FF_API_NVDEC_OLD_PIX_FMTS
- pix_fmts[1] = AV_PIX_FMT_YUV444P16;
-#else
pix_fmts[1] = AV_PIX_FMT_YUV444P12MSB;
-#endif
#ifdef NVDEC_HAVE_422_SUPPORT
} else if (format->chroma_format == cudaVideoChromaFormat_422) {
-#if FF_API_NVDEC_OLD_PIX_FMTS
- pix_fmts[1] = AV_PIX_FMT_P216;
-#else
pix_fmts[1] = AV_PIX_FMT_P212;
-#endif
#endif
} else {
-#if FF_API_NVDEC_OLD_PIX_FMTS
- pix_fmts[1] = AV_PIX_FMT_P016;
-#else
pix_fmts[1] = AV_PIX_FMT_P012;
-#endif
}
caps = &ctx->caps12;
break;
@@ -935,18 +915,10 @@ static av_cold int cuvid_decode_init(AVCodecContext *avctx)
// Pick pixel format based on bit depth and chroma sampling.
switch (probed_bit_depth) {
case 10:
-#if FF_API_NVDEC_OLD_PIX_FMTS
- pix_fmts[1] = is_yuv444 ? AV_PIX_FMT_YUV444P16 : (is_yuv422 ? AV_PIX_FMT_P216 : AV_PIX_FMT_P010);
-#else
pix_fmts[1] = is_yuv444 ? AV_PIX_FMT_YUV444P10MSB : (is_yuv422 ? AV_PIX_FMT_P210 : AV_PIX_FMT_P010);
-#endif
break;
case 12:
-#if FF_API_NVDEC_OLD_PIX_FMTS
- pix_fmts[1] = is_yuv444 ? AV_PIX_FMT_YUV444P16 : (is_yuv422 ? AV_PIX_FMT_P216 : AV_PIX_FMT_P016);
-#else
pix_fmts[1] = is_yuv444 ? AV_PIX_FMT_YUV444P12MSB : (is_yuv422 ? AV_PIX_FMT_P212 : AV_PIX_FMT_P012);
-#endif
break;
default:
pix_fmts[1] = is_yuv444 ? AV_PIX_FMT_YUV444P : (is_yuv422 ? AV_PIX_FMT_NV16 : AV_PIX_FMT_NV12);
diff --git a/libavcodec/nvdec.c b/libavcodec/nvdec.c
index e64ee7a9d6..6420483f38 100644
--- a/libavcodec/nvdec.c
+++ b/libavcodec/nvdec.c
@@ -764,11 +764,7 @@ int ff_nvdec_frame_params(AVCodecContext *avctx,
break;
case 10:
if (chroma_444) {
-#if FF_API_NVDEC_OLD_PIX_FMTS
- frames_ctx->sw_format = AV_PIX_FMT_YUV444P16;
-#else
frames_ctx->sw_format = AV_PIX_FMT_YUV444P10MSB;
-#endif
#ifdef NVDEC_HAVE_422_SUPPORT
} else if (cuvid_chroma_format == cudaVideoChromaFormat_422) {
frames_ctx->sw_format = AV_PIX_FMT_P210;
@@ -779,25 +775,13 @@ int ff_nvdec_frame_params(AVCodecContext *avctx,
break;
case 12:
if (chroma_444) {
-#if FF_API_NVDEC_OLD_PIX_FMTS
- frames_ctx->sw_format = AV_PIX_FMT_YUV444P16;
-#else
frames_ctx->sw_format = AV_PIX_FMT_YUV444P12MSB;
-#endif
#ifdef NVDEC_HAVE_422_SUPPORT
} else if (cuvid_chroma_format == cudaVideoChromaFormat_422) {
-#if FF_API_NVDEC_OLD_PIX_FMTS
- frames_ctx->sw_format = AV_PIX_FMT_P216;
-#else
frames_ctx->sw_format = AV_PIX_FMT_P212;
-#endif
#endif
} else {
-#if FF_API_NVDEC_OLD_PIX_FMTS
- frames_ctx->sw_format = AV_PIX_FMT_P016;
-#else
frames_ctx->sw_format = AV_PIX_FMT_P012;
-#endif
}
break;
default:
diff --git a/libavcodec/version_major.h b/libavcodec/version_major.h
index a0232c8fe2..85728d6623 100644
--- a/libavcodec/version_major.h
+++ b/libavcodec/version_major.h
@@ -43,9 +43,6 @@
#define FF_API_CODEC_PROPS (LIBAVCODEC_VERSION_MAJOR < 63)
#define FF_API_EXR_GAMMA (LIBAVCODEC_VERSION_MAJOR < 63)
#define FF_API_INTRA_DC_PRECISION (LIBAVCODEC_VERSION_MAJOR < 63)
-
-#define FF_API_NVDEC_OLD_PIX_FMTS (LIBAVCODEC_VERSION_MAJOR < 63)
-
#define FF_API_MJPEG_EXTERN_HUFF (LIBAVCODEC_VERSION_MAJOR < 63)
// reminder to remove Sonic Lossy/Lossless encoders on next major bump
#define FF_CODEC_SONIC_ENC (LIBAVCODEC_VERSION_MAJOR < 63)
--
2.52.0
From 96f526ddf6a9e785c2bad97e7cf6a3e470928ee5 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
Date: Mon, 9 Mar 2026 06:03:12 +0100
Subject: [PATCH 12/33] avcodec: Remove FF_API_V408_CODECID
Deprecated on 2024-10-12.
This also removes the v410 encoder, so the fate-v410enc test is switched
to muxing rawvideo in the equivalent v30xle pixel format; its md5 changes
as a result. The change is benign -- the decodable 10-bit 4:4:4 content is
bit-identical -- and has two independent causes, both in don't-care or
header bytes:
1. swscale's yuv444p10le->v30xle output packer fills the two unused padding
bits of each 32-bit sample with 1s, whereas the v410 encoder left them 0.
2. rawvideo derives bits_per_coded_sample from the pixel descriptor, which
counts only the three 10-bit components (30) and ignores the padding,
while the v410 encoder hard-coded 32. This alters biBitCount in the
BITMAPINFOHEADER as well as the byterate and sample/buffer-size fields
that the AVI muxer derives from the bitrate, all by the 32:30 ratio.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
---
libavcodec/allcodecs.c | 8 ---
libavcodec/codec_desc.c | 25 --------
libavcodec/codec_id.h | 9 ---
libavcodec/v308dec.c | 82 ------------------------
libavcodec/v308enc.c | 84 -------------------------
libavcodec/v408dec.c | 82 ------------------------
libavcodec/v408enc.c | 83 ------------------------
libavcodec/v410dec.c | 125 -------------------------------------
libavcodec/v410enc.c | 88 --------------------------
libavcodec/version.c | 2 +-
libavcodec/version_major.h | 1 -
libavformat/isom_tags.c | 5 --
libavformat/movenc.c | 8 +--
libavformat/riff.c | 5 --
tests/fate/video.mak | 6 +-
tests/ref/fate/v410enc | 2 +-
16 files changed, 6 insertions(+), 609 deletions(-)
delete mode 100644 libavcodec/v308dec.c
delete mode 100644 libavcodec/v308enc.c
delete mode 100644 libavcodec/v408dec.c
delete mode 100644 libavcodec/v408enc.c
delete mode 100644 libavcodec/v410dec.c
delete mode 100644 libavcodec/v410enc.c
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index d9375bce20..d21712a4d8 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -354,14 +354,6 @@ extern const FFCodec ff_utvideo_decoder;
extern const FFCodec ff_v210_encoder;
extern const FFCodec ff_v210_decoder;
extern const FFCodec ff_v210x_decoder;
-#if FF_API_V408_CODECID
-extern const FFCodec ff_v308_encoder;
-extern const FFCodec ff_v308_decoder;
-extern const FFCodec ff_v408_encoder;
-extern const FFCodec ff_v408_decoder;
-extern const FFCodec ff_v410_encoder;
-extern const FFCodec ff_v410_decoder;
-#endif
extern const FFCodec ff_vb_decoder;
extern const FFCodec ff_vbn_encoder;
extern const FFCodec ff_vbn_decoder;
diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c
index 7a16d002b9..81c095bea7 100644
--- a/libavcodec/codec_desc.c
+++ b/libavcodec/codec_desc.c
@@ -1146,15 +1146,6 @@ static const AVCodecDescriptor codec_descriptors[] = {
.long_name = NULL_IF_CONFIG_SMALL("Dxtory"),
.props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS,
},
-#if FF_API_V408_CODECID
- {
- .id = AV_CODEC_ID_V410,
- .type = AVMEDIA_TYPE_VIDEO,
- .name = "v410",
- .long_name = NULL_IF_CONFIG_SMALL("Uncompressed 4:4:4 10-bit"),
- .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS,
- },
-#endif
{
.id = AV_CODEC_ID_XWD,
.type = AVMEDIA_TYPE_VIDEO,
@@ -1479,22 +1470,6 @@ static const AVCodecDescriptor codec_descriptors[] = {
.long_name = NULL_IF_CONFIG_SMALL("Pinnacle TARGA CineWave YUV16"),
.props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS,
},
-#if FF_API_V408_CODECID
- {
- .id = AV_CODEC_ID_V308,
- .type = AVMEDIA_TYPE_VIDEO,
- .name = "v308",
- .long_name = NULL_IF_CONFIG_SMALL("Uncompressed packed 4:4:4"),
- .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS,
- },
- {
- .id = AV_CODEC_ID_V408,
- .type = AVMEDIA_TYPE_VIDEO,
- .name = "v408",
- .long_name = NULL_IF_CONFIG_SMALL("Uncompressed packed QT 4:4:4:4"),
- .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS,
- },
-#endif
{
.id = AV_CODEC_ID_YUV4,
.type = AVMEDIA_TYPE_VIDEO,
diff --git a/libavcodec/codec_id.h b/libavcodec/codec_id.h
index 1aad9ba0e9..668a068efe 100644
--- a/libavcodec/codec_id.h
+++ b/libavcodec/codec_id.h
@@ -24,8 +24,6 @@
#include "libavutil/avutil.h"
#include "libavutil/samplefmt.h"
-#include "version_major.h"
-
/**
* @addtogroup lavc_core
* @{
@@ -206,9 +204,6 @@ enum AVCodecID {
AV_CODEC_ID_BMV_VIDEO,
AV_CODEC_ID_VBLE,
AV_CODEC_ID_DXTORY,
-#if FF_API_V408_CODECID
- AV_CODEC_ID_V410,
-#endif
AV_CODEC_ID_XWD,
AV_CODEC_ID_CDXL,
AV_CODEC_ID_XBM,
@@ -256,10 +251,6 @@ enum AVCodecID {
AV_CODEC_ID_012V,
AV_CODEC_ID_AVUI,
AV_CODEC_ID_TARGA_Y216,
-#if FF_API_V408_CODECID
- AV_CODEC_ID_V308,
- AV_CODEC_ID_V408,
-#endif
AV_CODEC_ID_YUV4,
AV_CODEC_ID_AVRN,
AV_CODEC_ID_CPIA,
diff --git a/libavcodec/v308dec.c b/libavcodec/v308dec.c
deleted file mode 100644
index 64876b7e5a..0000000000
--- a/libavcodec/v308dec.c
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * v308 decoder
- * Copyright (c) 2011 Carl Eugen Hoyos
- *
- * 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 "avcodec.h"
-#include "codec_internal.h"
-#include "decode.h"
-
-static av_cold int v308_decode_init(AVCodecContext *avctx)
-{
- avctx->pix_fmt = AV_PIX_FMT_YUV444P;
-
- if (avctx->width & 1)
- av_log(avctx, AV_LOG_WARNING, "v308 requires width to be even.\n");
-
- av_log(avctx, AV_LOG_WARNING, "This decoder is deprecated and will be removed.\n");
-
- return 0;
-}
-
-static int v308_decode_frame(AVCodecContext *avctx, AVFrame *pic,
- int *got_frame, AVPacket *avpkt)
-{
- const uint8_t *src = avpkt->data;
- uint8_t *y, *u, *v;
- int i, j, ret;
-
- if (avpkt->size < 3 * avctx->height * avctx->width) {
- av_log(avctx, AV_LOG_ERROR, "Insufficient input data.\n");
- return AVERROR(EINVAL);
- }
-
- if ((ret = ff_get_buffer(avctx, pic, 0)) < 0)
- return ret;
-
- y = pic->data[0];
- u = pic->data[1];
- v = pic->data[2];
-
- for (i = 0; i < avctx->height; i++) {
- for (j = 0; j < avctx->width; j++) {
- v[j] = *src++;
- y[j] = *src++;
- u[j] = *src++;
- }
-
- y += pic->linesize[0];
- u += pic->linesize[1];
- v += pic->linesize[2];
- }
-
- *got_frame = 1;
-
- return avpkt->size;
-}
-
-const FFCodec ff_v308_decoder = {
- .p.name = "v308",
- CODEC_LONG_NAME("Uncompressed packed 4:4:4"),
- .p.type = AVMEDIA_TYPE_VIDEO,
- .p.id = AV_CODEC_ID_V308,
- .init = v308_decode_init,
- FF_CODEC_DECODE_CB(v308_decode_frame),
- .p.capabilities = AV_CODEC_CAP_DR1,
-};
diff --git a/libavcodec/v308enc.c b/libavcodec/v308enc.c
deleted file mode 100644
index 884932da44..0000000000
--- a/libavcodec/v308enc.c
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * v308 encoder
- *
- * Copyright (c) 2011 Carl Eugen Hoyos
- *
- * 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 "libavutil/intreadwrite.h"
-#include "avcodec.h"
-#include "codec_internal.h"
-#include "encode.h"
-#include "internal.h"
-
-static av_cold int v308_encode_init(AVCodecContext *avctx)
-{
- if (avctx->width & 1) {
- av_log(avctx, AV_LOG_ERROR, "v308 requires width to be even.\n");
- return AVERROR_INVALIDDATA;
- }
-
- av_log(avctx, AV_LOG_WARNING, "This encoder is deprecated and will be removed.\n");
-
- avctx->bits_per_coded_sample = 24;
- avctx->bit_rate = ff_guess_coded_bitrate(avctx);
-
- return 0;
-}
-
-static int v308_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
- const AVFrame *pic, int *got_packet)
-{
- uint8_t *dst;
- const uint8_t *y, *u, *v;
- int i, j, ret;
-
- ret = ff_get_encode_buffer(avctx, pkt, avctx->width * avctx->height * 3, 0);
- if (ret < 0)
- return ret;
- dst = pkt->data;
-
- y = pic->data[0];
- u = pic->data[1];
- v = pic->data[2];
-
- for (i = 0; i < avctx->height; i++) {
- for (j = 0; j < avctx->width; j++) {
- *dst++ = v[j];
- *dst++ = y[j];
- *dst++ = u[j];
- }
- y += pic->linesize[0];
- u += pic->linesize[1];
- v += pic->linesize[2];
- }
-
- *got_packet = 1;
- return 0;
-}
-
-const FFCodec ff_v308_encoder = {
- .p.name = "v308",
- CODEC_LONG_NAME("Uncompressed packed 4:4:4"),
- .p.type = AVMEDIA_TYPE_VIDEO,
- .p.id = AV_CODEC_ID_V308,
- .p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE,
- .init = v308_encode_init,
- FF_CODEC_ENCODE_CB(v308_encode_frame),
- CODEC_PIXFMTS(AV_PIX_FMT_YUV444P),
-};
diff --git a/libavcodec/v408dec.c b/libavcodec/v408dec.c
deleted file mode 100644
index 4bce5c7b67..0000000000
--- a/libavcodec/v408dec.c
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * v408 decoder
- * Copyright (c) 2012 Carl Eugen Hoyos
- *
- * 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 "avcodec.h"
-#include "codec_internal.h"
-#include "decode.h"
-
-static av_cold int v408_decode_init(AVCodecContext *avctx)
-{
- avctx->pix_fmt = AV_PIX_FMT_YUVA444P;
-
- av_log(avctx, AV_LOG_WARNING, "This decoder is deprecated and will be removed.\n");
-
- return 0;
-}
-
-static int v408_decode_frame(AVCodecContext *avctx, AVFrame *pic,
- int *got_frame, AVPacket *avpkt)
-{
- const uint8_t *src = avpkt->data;
- uint8_t *y, *u, *v, *a;
- int i, j, ret;
-
- if (avpkt->size < 4 * avctx->height * avctx->width) {
- av_log(avctx, AV_LOG_ERROR, "Insufficient input data.\n");
- return AVERROR(EINVAL);
- }
-
- if ((ret = ff_get_buffer(avctx, pic, 0)) < 0)
- return ret;
-
- y = pic->data[0];
- u = pic->data[1];
- v = pic->data[2];
- a = pic->data[3];
-
- for (i = 0; i < avctx->height; i++) {
- for (j = 0; j < avctx->width; j++) {
- u[j] = *src++;
- y[j] = *src++;
- v[j] = *src++;
- a[j] = *src++;
- }
-
- y += pic->linesize[0];
- u += pic->linesize[1];
- v += pic->linesize[2];
- a += pic->linesize[3];
- }
-
- *got_frame = 1;
-
- return avpkt->size;
-}
-
-const FFCodec ff_v408_decoder = {
- .p.name = "v408",
- CODEC_LONG_NAME("Uncompressed packed QT 4:4:4:4"),
- .p.type = AVMEDIA_TYPE_VIDEO,
- .p.id = AV_CODEC_ID_V408,
- .init = v408_decode_init,
- FF_CODEC_DECODE_CB(v408_decode_frame),
- .p.capabilities = AV_CODEC_CAP_DR1,
-};
diff --git a/libavcodec/v408enc.c b/libavcodec/v408enc.c
deleted file mode 100644
index 4b6717a1fb..0000000000
--- a/libavcodec/v408enc.c
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * v408 encoder
- *
- * Copyright (c) 2012 Carl Eugen Hoyos
- *
- * 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 "avcodec.h"
-#include "codec_internal.h"
-#include "encode.h"
-#include "internal.h"
-
-static av_cold int v408_encode_init(AVCodecContext *avctx)
-{
- avctx->bits_per_coded_sample = 32;
- avctx->bit_rate = ff_guess_coded_bitrate(avctx);
-
- av_log(avctx, AV_LOG_WARNING, "This encoder is deprecated and will be removed.\n");
-
- return 0;
-}
-
-static int v408_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
- const AVFrame *pic, int *got_packet)
-{
- uint8_t *dst;
- const uint8_t *y, *u, *v, *a;
- int i, j, ret;
-
- ret = ff_get_encode_buffer(avctx, pkt, avctx->width * avctx->height * 4, 0);
- if (ret < 0)
- return ret;
- dst = pkt->data;
-
- y = pic->data[0];
- u = pic->data[1];
- v = pic->data[2];
- a = pic->data[3];
-
- for (i = 0; i < avctx->height; i++) {
- for (j = 0; j < avctx->width; j++) {
- *dst++ = u[j];
- *dst++ = y[j];
- *dst++ = v[j];
- *dst++ = a[j];
- }
- y += pic->linesize[0];
- u += pic->linesize[1];
- v += pic->linesize[2];
- a += pic->linesize[3];
- }
-
- *got_packet = 1;
- return 0;
-}
-
-static const enum AVPixelFormat pix_fmt[] = { AV_PIX_FMT_YUVA444P, AV_PIX_FMT_NONE };
-
-const FFCodec ff_v408_encoder = {
- .p.name = "v408",
- CODEC_LONG_NAME("Uncompressed packed QT 4:4:4:4"),
- .p.type = AVMEDIA_TYPE_VIDEO,
- .p.id = AV_CODEC_ID_V408,
- .p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE,
- .init = v408_encode_init,
- FF_CODEC_ENCODE_CB(v408_encode_frame),
- CODEC_PIXFMTS_ARRAY(pix_fmt),
-};
diff --git a/libavcodec/v410dec.c b/libavcodec/v410dec.c
deleted file mode 100644
index d3747c18e0..0000000000
--- a/libavcodec/v410dec.c
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * v410 decoder
- *
- * Copyright (c) 2011 Derek Buitenhuis
- *
- * 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 "libavutil/common.h"
-#include "libavutil/intreadwrite.h"
-#include "avcodec.h"
-#include "codec_internal.h"
-#include "thread.h"
-
-typedef struct ThreadData {
- AVFrame *frame;
- const uint8_t *buf;
- int stride;
-} ThreadData;
-
-static av_cold int v410_decode_init(AVCodecContext *avctx)
-{
- avctx->pix_fmt = AV_PIX_FMT_YUV444P10;
- avctx->bits_per_raw_sample = 10;
-
- if (avctx->width & 1) {
- if (avctx->err_recognition & AV_EF_EXPLODE) {
- av_log(avctx, AV_LOG_ERROR, "v410 requires width to be even.\n");
- return AVERROR_INVALIDDATA;
- } else {
- av_log(avctx, AV_LOG_WARNING, "v410 requires width to be even, continuing anyway.\n");
- }
- }
-
- av_log(avctx, AV_LOG_WARNING, "This decoder is deprecated and will be removed.\n");
-
- return 0;
-}
-
-static int v410_decode_slice(AVCodecContext *avctx, void *arg, int jobnr, int threadnr)
-{
- ThreadData *td = arg;
- AVFrame *pic = td->frame;
- int stride = td->stride;
- int thread_count = av_clip(avctx->thread_count, 1, avctx->height/4);
- int slice_start = (avctx->height * jobnr) / thread_count;
- int slice_end = (avctx->height * (jobnr+1)) / thread_count;
- const uint8_t *src = td->buf + stride * slice_start;
- uint16_t *y, *u, *v;
- uint32_t val;
- int i, j;
-
- y = (uint16_t*)pic->data[0] + slice_start * (pic->linesize[0] >> 1);
- u = (uint16_t*)pic->data[1] + slice_start * (pic->linesize[1] >> 1);
- v = (uint16_t*)pic->data[2] + slice_start * (pic->linesize[2] >> 1);
-
- for (i = slice_start; i < slice_end; i++) {
- for (j = 0; j < avctx->width; j++) {
- val = AV_RL32(src);
-
- u[j] = (val >> 2) & 0x3FF;
- y[j] = (val >> 12) & 0x3FF;
- v[j] = (val >> 22);
-
- src += 4;
- }
-
- y += pic->linesize[0] >> 1;
- u += pic->linesize[1] >> 1;
- v += pic->linesize[2] >> 1;
- }
-
- return 0;
-}
-
-static int v410_decode_frame(AVCodecContext *avctx, AVFrame *pic,
- int *got_frame, AVPacket *avpkt)
-{
- ThreadData td;
- const uint8_t *src = avpkt->data;
- int ret;
- int thread_count = av_clip(avctx->thread_count, 1, avctx->height/4);
-
- td.stride = avctx->width * 4;
- if (avpkt->size < 4 * avctx->height * avctx->width) {
- av_log(avctx, AV_LOG_ERROR, "Insufficient input data.\n");
- return AVERROR(EINVAL);
- }
-
- if ((ret = ff_thread_get_buffer(avctx, pic, 0)) < 0)
- return ret;
-
- td.buf = src;
- td.frame = pic;
- avctx->execute2(avctx, v410_decode_slice, &td, NULL, thread_count);
-
- *got_frame = 1;
-
- return avpkt->size;
-}
-
-const FFCodec ff_v410_decoder = {
- .p.name = "v410",
- CODEC_LONG_NAME("Uncompressed 4:4:4 10-bit"),
- .p.type = AVMEDIA_TYPE_VIDEO,
- .p.id = AV_CODEC_ID_V410,
- .init = v410_decode_init,
- FF_CODEC_DECODE_CB(v410_decode_frame),
- .p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_SLICE_THREADS |
- AV_CODEC_CAP_FRAME_THREADS,
-};
diff --git a/libavcodec/v410enc.c b/libavcodec/v410enc.c
deleted file mode 100644
index 1350acebba..0000000000
--- a/libavcodec/v410enc.c
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * v410 encoder
- *
- * Copyright (c) 2011 Derek Buitenhuis
- *
- * 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 "libavutil/common.h"
-#include "libavutil/intreadwrite.h"
-#include "avcodec.h"
-#include "codec_internal.h"
-#include "encode.h"
-#include "internal.h"
-
-static av_cold int v410_encode_init(AVCodecContext *avctx)
-{
- if (avctx->width & 1) {
- av_log(avctx, AV_LOG_ERROR, "v410 requires width to be even.\n");
- return AVERROR_INVALIDDATA;
- }
-
- avctx->bits_per_coded_sample = 32;
- avctx->bit_rate = ff_guess_coded_bitrate(avctx);
-
- av_log(avctx, AV_LOG_WARNING, "This encoder is deprecated and will be removed.\n");
-
- return 0;
-}
-
-static int v410_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
- const AVFrame *pic, int *got_packet)
-{
- uint8_t *dst;
- const uint16_t *y, *u, *v;
- uint32_t val;
- int i, j, ret;
-
- ret = ff_get_encode_buffer(avctx, pkt, avctx->width * avctx->height * 4, 0);
- if (ret < 0)
- return ret;
- dst = pkt->data;
-
- y = (uint16_t *)pic->data[0];
- u = (uint16_t *)pic->data[1];
- v = (uint16_t *)pic->data[2];
-
- for (i = 0; i < avctx->height; i++) {
- for (j = 0; j < avctx->width; j++) {
- val = u[j] << 2;
- val |= y[j] << 12;
- val |= (uint32_t) v[j] << 22;
- AV_WL32(dst, val);
- dst += 4;
- }
- y += pic->linesize[0] >> 1;
- u += pic->linesize[1] >> 1;
- v += pic->linesize[2] >> 1;
- }
-
- *got_packet = 1;
- return 0;
-}
-
-const FFCodec ff_v410_encoder = {
- .p.name = "v410",
- CODEC_LONG_NAME("Uncompressed 4:4:4 10-bit"),
- .p.type = AVMEDIA_TYPE_VIDEO,
- .p.id = AV_CODEC_ID_V410,
- .p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE,
- .init = v410_encode_init,
- FF_CODEC_ENCODE_CB(v410_encode_frame),
- CODEC_PIXFMTS(AV_PIX_FMT_YUV444P10),
-};
diff --git a/libavcodec/version.c b/libavcodec/version.c
index 07e8e47e44..3243ca2df7 100644
--- a/libavcodec/version.c
+++ b/libavcodec/version.c
@@ -31,7 +31,7 @@ const char av_codec_ffversion[] = "FFmpeg version " FFMPEG_VERSION;
unsigned avcodec_version(void)
{
- static_assert(AV_CODEC_ID_PRORES_RAW == 274 &&
+ static_assert(AV_CODEC_ID_JPEGXS == 272 &&
AV_CODEC_ID_PCM_SGA == 65572 &&
AV_CODEC_ID_ADPCM_SANYO == 69685 &&
AV_CODEC_ID_CBD2_DPCM == 81928 &&
diff --git a/libavcodec/version_major.h b/libavcodec/version_major.h
index 85728d6623..01c48fd73f 100644
--- a/libavcodec/version_major.h
+++ b/libavcodec/version_major.h
@@ -39,7 +39,6 @@
#define FF_API_INIT_PACKET (LIBAVCODEC_VERSION_MAJOR < 63)
-#define FF_API_V408_CODECID (LIBAVCODEC_VERSION_MAJOR < 63)
#define FF_API_CODEC_PROPS (LIBAVCODEC_VERSION_MAJOR < 63)
#define FF_API_EXR_GAMMA (LIBAVCODEC_VERSION_MAJOR < 63)
#define FF_API_INTRA_DC_PRECISION (LIBAVCODEC_VERSION_MAJOR < 63)
diff --git a/libavformat/isom_tags.c b/libavformat/isom_tags.c
index 556f0eeea4..c0c239d393 100644
--- a/libavformat/isom_tags.c
+++ b/libavformat/isom_tags.c
@@ -63,11 +63,6 @@ const AVCodecTag ff_codec_movvideo_tags[] = {
{ AV_CODEC_ID_AVRP, MKTAG('S', 'U', 'D', 'S') }, /* Avid DS Uncompressed */
{ AV_CODEC_ID_V210, MKTAG('v', '2', '1', '0') }, /* uncompressed 10-bit 4:2:2 */
{ AV_CODEC_ID_V210, MKTAG('b', 'x', 'y', '2') }, /* BOXX 10-bit 4:2:2 */
-#if FF_API_V408_CODECID
- { AV_CODEC_ID_V308, MKTAG('v', '3', '0', '8') }, /* uncompressed 8-bit 4:4:4 */
- { AV_CODEC_ID_V408, MKTAG('v', '4', '0', '8') }, /* uncompressed 8-bit 4:4:4:4 */
- { AV_CODEC_ID_V410, MKTAG('v', '4', '1', '0') }, /* uncompressed 10-bit 4:4:4 */
-#endif
{ AV_CODEC_ID_Y41P, MKTAG('Y', '4', '1', 'P') }, /* uncompressed 12-bit 4:1:1 */
{ AV_CODEC_ID_YUV4, MKTAG('y', 'u', 'v', '4') }, /* libquicktime packed yuv420p */
{ AV_CODEC_ID_TARGA_Y216, MKTAG('Y', '2', '1', '6') },
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 7c9dbb29f7..d5247ad45e 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -2806,11 +2806,6 @@ static int mov_write_video_tag(AVFormatContext *s, AVIOContext *pb, MOVMuxContex
|| (track->par->codec_id == AV_CODEC_ID_RAWVIDEO && track->par->format == AV_PIX_FMT_VYU444)
|| (track->par->codec_id == AV_CODEC_ID_RAWVIDEO && track->par->format == AV_PIX_FMT_UYVA)
|| (track->par->codec_id == AV_CODEC_ID_RAWVIDEO && track->par->format == AV_PIX_FMT_V30XLE)
-#if FF_API_V408_CODECID
- || track->par->codec_id == AV_CODEC_ID_V308
- || track->par->codec_id == AV_CODEC_ID_V408
- || track->par->codec_id == AV_CODEC_ID_V410
-#endif
|| track->par->codec_id == AV_CODEC_ID_V210);
avio_wb32(pb, 0); /* size */
@@ -2852,8 +2847,7 @@ static int mov_write_video_tag(AVFormatContext *s, AVIOContext *pb, MOVMuxContex
avio_w8(pb, strlen(compressor_name));
avio_write(pb, compressor_name, 31);
- if (track->mode == MODE_MOV &&
- (track->par->codec_id == AV_CODEC_ID_V410 || track->par->codec_id == AV_CODEC_ID_V210))
+ if (track->mode == MODE_MOV && track->par->codec_id == AV_CODEC_ID_V210)
avio_wb16(pb, 0x18);
else if (track->mode == MODE_MOV && track->par->bits_per_coded_sample)
avio_wb16(pb, track->par->bits_per_coded_sample |
diff --git a/libavformat/riff.c b/libavformat/riff.c
index fc79d0ac21..21de951e3a 100644
--- a/libavformat/riff.c
+++ b/libavformat/riff.c
@@ -309,11 +309,6 @@ const AVCodecTag ff_codec_bmp_tags[] = {
{ AV_CODEC_ID_R210, MKTAG('r', '2', '1', '0') },
{ AV_CODEC_ID_V210, MKTAG('v', '2', '1', '0') },
{ AV_CODEC_ID_V210, MKTAG('C', '2', '1', '0') },
-#if FF_API_V408_CODECID
- { AV_CODEC_ID_V308, MKTAG('v', '3', '0', '8') },
- { AV_CODEC_ID_V408, MKTAG('v', '4', '0', '8') },
- { AV_CODEC_ID_V410, MKTAG('v', '4', '1', '0') },
-#endif
{ AV_CODEC_ID_YUV4, MKTAG('y', 'u', 'v', '4') },
{ AV_CODEC_ID_INDEO3, MKTAG('I', 'V', '3', '1') },
{ AV_CODEC_ID_INDEO3, MKTAG('I', 'V', '3', '2') },
diff --git a/tests/fate/video.mak b/tests/fate/video.mak
index 10d1b20cd5..fa7b202052 100644
--- a/tests/fate/video.mak
+++ b/tests/fate/video.mak
@@ -368,12 +368,12 @@ fate-ulti: CMD = framecrc -i $(TARGET_SAMPLES)/ulti/hit12w.avi -an
FATE_VIDEO-$(call FRAMECRC, AVI, V210, SCALE_FILTER) += fate-v210
fate-v210: CMD = framecrc -i $(TARGET_SAMPLES)/v210/v210_720p-partial.avi -pix_fmt yuv422p16be -an -vf scale
-FATE_VIDEO-$(call FRAMECRC, MOV, V410, SCALE_FILTER) += fate-v410dec
+FATE_VIDEO-$(call FRAMECRC, MOV, RAWVIDEO, SCALE_FILTER) += fate-v410dec
fate-v410dec: CMD = framecrc -i $(TARGET_SAMPLES)/v410/lenav410.mov -pix_fmt yuv444p10le -vf scale
-FATE_VIDEO-$(call ENCDEC, V410 PGMYUV, AVI IMAGE2, SCALE_FILTER) += fate-v410enc
+FATE_VIDEO-$(call ENCDEC, RAWVIDEO PGMYUV, AVI IMAGE2, SCALE_FILTER) += fate-v410enc
fate-v410enc: $(VREF)
-fate-v410enc: CMD = md5 -f image2 -c:v pgmyuv -i $(TARGET_PATH)/tests/vsynth1/%02d.pgm -fflags +bitexact -c:v v410 -f avi -vf scale
+fate-v410enc: CMD = md5 -f image2 -c:v pgmyuv -i $(TARGET_PATH)/tests/vsynth1/%02d.pgm -fflags +bitexact -c:v rawvideo -pix_fmt v30xle -f avi -vf scale
FATE_VIDEO-$(call FRAMECRC, SIFF, VB, SCALE_FILTER) += fate-vb
fate-vb: CMD = framecrc -i $(TARGET_SAMPLES)/SIFF/INTRO_B.VB -t 3 -pix_fmt rgb24 -an -vf scale
diff --git a/tests/ref/fate/v410enc b/tests/ref/fate/v410enc
index 9fddf5a35c..cce8cb87f5 100644
--- a/tests/ref/fate/v410enc
+++ b/tests/ref/fate/v410enc
@@ -1 +1 @@
-465bcc7477104a8295f47b35f1b987df
+8e7fcce494f16a3d1dd62eb475bd0e4e
--
2.52.0
From a39001f1950abf34c6ee0a94364c920d9e3f8e72 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
Date: Mon, 9 Mar 2026 06:16:32 +0100
Subject: [PATCH 13/33] avcodec: Remove FF_API_CODEC_PROPS
Deprecated since 2025-01-05.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
---
libavcodec/av1dec.c | 9 ---------
libavcodec/avcodec.c | 11 -----------
libavcodec/avcodec.h | 13 -------------
libavcodec/h2645_sei.c | 11 -----------
libavcodec/hevc/hevcdec.c | 15 ---------------
libavcodec/itut35.c | 6 ------
libavcodec/jpeg2000dec.c | 7 -------
libavcodec/libdav1d.c | 9 ---------
libavcodec/mjpegdec.c | 10 ----------
libavcodec/mpeg12dec.c | 6 ------
libavcodec/pthread_frame.c | 8 --------
libavcodec/version_major.h | 1 -
libavcodec/vp9.c | 6 ------
libavcodec/webp.c | 10 ----------
libavformat/dump.c | 5 -----
15 files changed, 127 deletions(-)
diff --git a/libavcodec/av1dec.c b/libavcodec/av1dec.c
index 424bbfc431..d614c8d68a 100644
--- a/libavcodec/av1dec.c
+++ b/libavcodec/av1dec.c
@@ -792,15 +792,6 @@ static int set_context_with_sequence(AVCodecContext *avctx,
break;
}
-#if FF_API_CODEC_PROPS
-FF_DISABLE_DEPRECATION_WARNINGS
- if (seq->film_grain_params_present)
- avctx->properties |= FF_CODEC_PROPERTY_FILM_GRAIN;
- else
- avctx->properties &= ~FF_CODEC_PROPERTY_FILM_GRAIN;
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif
-
if (avctx->width != width || avctx->height != height) {
int ret = ff_set_dimensions(avctx, width, height);
if (ret < 0)
diff --git a/libavcodec/avcodec.c b/libavcodec/avcodec.c
index e6a28d8bab..23ccac1a85 100644
--- a/libavcodec/avcodec.c
+++ b/libavcodec/avcodec.c
@@ -647,17 +647,6 @@ void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode)
}
if (encode) {
av_bprintf(&bprint, ", q=%d-%d", enc->qmin, enc->qmax);
- } else {
-#if FF_API_CODEC_PROPS
-FF_DISABLE_DEPRECATION_WARNINGS
- if (enc->properties & FF_CODEC_PROPERTY_CLOSED_CAPTIONS)
- av_bprintf(&bprint, ", Closed Captions");
- if (enc->properties & FF_CODEC_PROPERTY_FILM_GRAIN)
- av_bprintf(&bprint, ", Film Grain");
- if (enc->properties & FF_CODEC_PROPERTY_LOSSLESS)
- av_bprintf(&bprint, ", lossless");
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif
}
break;
case AVMEDIA_TYPE_AUDIO:
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index f45e8d8baa..6bce0d388d 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -1645,19 +1645,6 @@ typedef struct AVCodecContext {
*/
int level;
-#if FF_API_CODEC_PROPS
- /**
- * Properties of the stream that gets decoded
- * - encoding: unused
- * - decoding: set by libavcodec
- */
- attribute_deprecated
- unsigned properties;
-#define FF_CODEC_PROPERTY_LOSSLESS 0x00000001
-#define FF_CODEC_PROPERTY_CLOSED_CAPTIONS 0x00000002
-#define FF_CODEC_PROPERTY_FILM_GRAIN 0x00000004
-#endif
-
/**
* Skip loop filtering for selected frames.
* - encoding: unused
diff --git a/libavcodec/h2645_sei.c b/libavcodec/h2645_sei.c
index edd990335d..735199733c 100644
--- a/libavcodec/h2645_sei.c
+++ b/libavcodec/h2645_sei.c
@@ -607,11 +607,6 @@ int ff_h2645_sei_to_frame(AVFrame *frame, H2645SEI *sei,
if (!sd)
av_buffer_unref(&itut_t35->a53_cc);
itut_t35->a53_cc = NULL;
-#if FF_API_CODEC_PROPS
-FF_DISABLE_DEPRECATION_WARNINGS
- avctx->properties |= FF_CODEC_PROPERTY_CLOSED_CAPTIONS;
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif
}
ret = h2645_sei_to_side_data(avctx, sei, &frame->side_data, &frame->nb_side_data);
@@ -688,12 +683,6 @@ FF_ENABLE_DEPRECATION_WARNINGS
fgc->present = !!fgc->repetition_period;
else
fgc->present = fgc->persistence_flag;
-
-#if FF_API_CODEC_PROPS
-FF_DISABLE_DEPRECATION_WARNINGS
- avctx->properties |= FF_CODEC_PROPERTY_FILM_GRAIN;
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif
}
#if CONFIG_HEVC_SEI
diff --git a/libavcodec/hevc/hevcdec.c b/libavcodec/hevc/hevcdec.c
index 304c7447ca..ae064ec8af 100644
--- a/libavcodec/hevc/hevcdec.c
+++ b/libavcodec/hevc/hevcdec.c
@@ -389,27 +389,12 @@ static int export_stream_params_from_sei(HEVCContext *s)
{
AVCodecContext *avctx = s->avctx;
-#if FF_API_CODEC_PROPS
-FF_DISABLE_DEPRECATION_WARNINGS
- if (s->sei.common.itut_t35.a53_cc)
- s->avctx->properties |= FF_CODEC_PROPERTY_CLOSED_CAPTIONS;
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif
-
if (s->sei.common.alternative_transfer.present &&
av_color_transfer_name(s->sei.common.alternative_transfer.preferred_transfer_characteristics) &&
s->sei.common.alternative_transfer.preferred_transfer_characteristics != AVCOL_TRC_UNSPECIFIED) {
avctx->color_trc = s->sei.common.alternative_transfer.preferred_transfer_characteristics;
}
-#if FF_API_CODEC_PROPS
-FF_DISABLE_DEPRECATION_WARNINGS
- if ((s->sei.common.film_grain_characteristics && s->sei.common.film_grain_characteristics->present) ||
- s->sei.common.itut_t35.aom_film_grain.enable)
- avctx->properties |= FF_CODEC_PROPERTY_FILM_GRAIN;
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif
-
return 0;
}
diff --git a/libavcodec/itut35.c b/libavcodec/itut35.c
index 8debf89ab3..b41d41406d 100644
--- a/libavcodec/itut35.c
+++ b/libavcodec/itut35.c
@@ -339,12 +339,6 @@ int ff_itut_t35_parse_payload_to_frame(FFITUTT35 *const itut_t35, FFITUTT35Aux *
ret = ff_frame_new_side_data_from_buf(avctx, frame, AV_FRAME_DATA_A53_CC, &metadata.a53_cc);
if (ret < 0)
return ret;
-
-#if FF_API_CODEC_PROPS
-FF_DISABLE_DEPRECATION_WARNINGS
- avctx->properties |= FF_CODEC_PROPERTY_CLOSED_CAPTIONS;
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif
}
if (metadata.aom_film_grain.enable) {
diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
index ed8ff83fd0..c705f04c44 100644
--- a/libavcodec/jpeg2000dec.c
+++ b/libavcodec/jpeg2000dec.c
@@ -566,13 +566,6 @@ static int get_cox(Jpeg2000DecoderContext *s, Jpeg2000CodingStyle *c)
/* set integer 9/7 DWT in case of BITEXACT flag */
if ((s->avctx->flags & AV_CODEC_FLAG_BITEXACT) && (c->transform == FF_DWT97))
c->transform = FF_DWT97_INT;
-#if FF_API_CODEC_PROPS
- else if (c->transform == FF_DWT53) {
-FF_DISABLE_DEPRECATION_WARNINGS
- s->avctx->properties |= FF_CODEC_PROPERTY_LOSSLESS;
-FF_ENABLE_DEPRECATION_WARNINGS
- }
-#endif
if (c->csty & JPEG2000_CSTY_PREC) {
int i;
diff --git a/libavcodec/libdav1d.c b/libavcodec/libdav1d.c
index 77b4c5521b..b41b741c0d 100644
--- a/libavcodec/libdav1d.c
+++ b/libavcodec/libdav1d.c
@@ -158,15 +158,6 @@ static void libdav1d_init_params(AVCodecContext *c, const Dav1dSequenceHeader *s
c->framerate = ff_av1_framerate(seq->num_ticks_per_picture,
(unsigned)seq->num_units_in_tick,
(unsigned)seq->time_scale);
-
-#if FF_API_CODEC_PROPS
-FF_DISABLE_DEPRECATION_WARNINGS
- if (seq->film_grain_present)
- c->properties |= FF_CODEC_PROPERTY_FILM_GRAIN;
- else
- c->properties &= ~FF_CODEC_PROPERTY_FILM_GRAIN;
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif
}
static av_cold int libdav1d_parse_extradata(AVCodecContext *c)
diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
index 472431ec72..0853d76372 100644
--- a/libavcodec/mjpegdec.c
+++ b/libavcodec/mjpegdec.c
@@ -2505,11 +2505,6 @@ redo_for_pal8:
break;
case SOF3:
avctx->profile = AV_PROFILE_MJPEG_HUFFMAN_LOSSLESS;
-#if FF_API_CODEC_PROPS
-FF_DISABLE_DEPRECATION_WARNINGS
- avctx->properties |= FF_CODEC_PROPERTY_LOSSLESS;
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif
s->lossless = 1;
s->ls = 0;
s->progressive = 0;
@@ -2518,11 +2513,6 @@ FF_ENABLE_DEPRECATION_WARNINGS
break;
case SOF55:
avctx->profile = AV_PROFILE_MJPEG_JPEG_LS;
-#if FF_API_CODEC_PROPS
-FF_DISABLE_DEPRECATION_WARNINGS
- avctx->properties |= FF_CODEC_PROPERTY_LOSSLESS;
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif
s->lossless = 1;
s->ls = 1;
s->progressive = 0;
diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
index ce3066e4a0..19ad08d10e 100644
--- a/libavcodec/mpeg12dec.c
+++ b/libavcodec/mpeg12dec.c
@@ -1890,12 +1890,6 @@ static void mpeg_set_cc_format(AVCodecContext *avctx, enum Mpeg2ClosedCaptionsFo
av_log(avctx, AV_LOG_DEBUG, "CC: first seen substream is %s format\n", label);
}
-
-#if FF_API_CODEC_PROPS
-FF_DISABLE_DEPRECATION_WARNINGS
- avctx->properties |= FF_CODEC_PROPERTY_CLOSED_CAPTIONS;
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif
}
static int mpeg_decode_a53_cc(AVCodecContext *avctx,
diff --git a/libavcodec/pthread_frame.c b/libavcodec/pthread_frame.c
index c2853086ce..e6dcc23c15 100644
--- a/libavcodec/pthread_frame.c
+++ b/libavcodec/pthread_frame.c
@@ -26,7 +26,6 @@
#include "avcodec.h"
#include "avcodec_internal.h"
-#include "codec_desc.h"
#include "codec_internal.h"
#include "decode.h"
#include "hwaccel_internal.h"
@@ -37,11 +36,9 @@
#include "libavutil/refstruct.h"
#include "thread.h"
#include "threadframe.h"
-#include "version_major.h"
#include "libavutil/avassert.h"
#include "libavutil/buffer.h"
-#include "libavutil/common.h"
#include "libavutil/cpu.h"
#include "libavutil/frame.h"
#include "libavutil/internal.h"
@@ -361,11 +358,6 @@ static int update_context_from_thread(AVCodecContext *dst, const AVCodecContext
dst->has_b_frames = src->has_b_frames;
dst->idct_algo = src->idct_algo;
-#if FF_API_CODEC_PROPS
-FF_DISABLE_DEPRECATION_WARNINGS
- dst->properties = src->properties;
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif
dst->bits_per_coded_sample = src->bits_per_coded_sample;
dst->sample_aspect_ratio = src->sample_aspect_ratio;
diff --git a/libavcodec/version_major.h b/libavcodec/version_major.h
index 01c48fd73f..e159e789c0 100644
--- a/libavcodec/version_major.h
+++ b/libavcodec/version_major.h
@@ -39,7 +39,6 @@
#define FF_API_INIT_PACKET (LIBAVCODEC_VERSION_MAJOR < 63)
-#define FF_API_CODEC_PROPS (LIBAVCODEC_VERSION_MAJOR < 63)
#define FF_API_EXR_GAMMA (LIBAVCODEC_VERSION_MAJOR < 63)
#define FF_API_INTRA_DC_PRECISION (LIBAVCODEC_VERSION_MAJOR < 63)
#define FF_API_MJPEG_EXTERN_HUFF (LIBAVCODEC_VERSION_MAJOR < 63)
diff --git a/libavcodec/vp9.c b/libavcodec/vp9.c
index 7957cbeab9..8ea313532a 100644
--- a/libavcodec/vp9.c
+++ b/libavcodec/vp9.c
@@ -706,12 +706,6 @@ static int decode_frame_header(AVCodecContext *avctx,
s->s.h.uvac_qdelta = get_bits1(&s->gb) ? get_sbits_inv(&s->gb, 4) : 0;
s->s.h.lossless = s->s.h.yac_qi == 0 && s->s.h.ydc_qdelta == 0 &&
s->s.h.uvdc_qdelta == 0 && s->s.h.uvac_qdelta == 0;
-#if FF_API_CODEC_PROPS
-FF_DISABLE_DEPRECATION_WARNINGS
- if (s->s.h.lossless)
- avctx->properties |= FF_CODEC_PROPERTY_LOSSLESS;
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif
/* segmentation header info */
if ((s->s.h.segmentation.enabled = get_bits1(&s->gb))) {
diff --git a/libavcodec/webp.c b/libavcodec/webp.c
index b5af60c673..e4174f0828 100644
--- a/libavcodec/webp.c
+++ b/libavcodec/webp.c
@@ -1408,11 +1408,6 @@ static int webp_decode_frame(AVCodecContext *avctx, AVFrame *p,
chunk_size, 0);
if (ret < 0)
return ret;
-#if FF_API_CODEC_PROPS
-FF_DISABLE_DEPRECATION_WARNINGS
- avctx->properties |= FF_CODEC_PROPERTY_LOSSLESS;
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif
}
bytestream2_skip(&gb, chunk_size);
break;
@@ -2103,11 +2098,6 @@ static int webp_anim_decode_frame(AVCodecContext *avctx, AVFrame *p,
ret = prepare_canvas(s, key_frame, AV_PIX_FMT_ARGB);
if (ret < 0)
goto end;
-#if FF_API_CODEC_PROPS
-FF_DISABLE_DEPRECATION_WARNINGS
- avctx->properties |= FF_CODEC_PROPERTY_LOSSLESS;
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif
bytestream2_skip(&gb, chunk_size);
break;
default:
diff --git a/libavformat/dump.c b/libavformat/dump.c
index 48f96611b8..6a1ad91516 100644
--- a/libavformat/dump.c
+++ b/libavformat/dump.c
@@ -615,11 +615,6 @@ static void dump_stream_format(const AVFormatContext *ic, int i,
// Fields which are missing from AVCodecParameters need to be taken from the AVCodecContext
if (sti->avctx) {
-#if FF_API_CODEC_PROPS
-FF_DISABLE_DEPRECATION_WARNINGS
- avctx->properties = sti->avctx->properties;
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif
avctx->codec = sti->avctx->codec;
avctx->qmin = sti->avctx->qmin;
avctx->qmax = sti->avctx->qmax;
--
2.52.0
From 1ce1e97bafd16086436c71462abf51848ebe4598 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
Date: Mon, 9 Mar 2026 06:21:48 +0100
Subject: [PATCH 14/33] avcodec/exr: Remove FF_API_EXR_GAMMA
Deprecated on 2025-03-28.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
---
libavcodec/exr.c | 117 ++-----------------------------------
libavcodec/version_major.h | 1 -
2 files changed, 5 insertions(+), 113 deletions(-)
diff --git a/libavcodec/exr.c b/libavcodec/exr.c
index 6b52c7e8ef..bef1d62485 100644
--- a/libavcodec/exr.c
+++ b/libavcodec/exr.c
@@ -36,7 +36,6 @@
#include "libavutil/avassert.h"
#include "libavutil/common.h"
-#include "libavutil/csp.h"
#include "libavutil/imgutils.h"
#include "libavutil/intfloat.h"
#include "libavutil/avstring.h"
@@ -192,15 +191,8 @@ typedef struct EXRContext {
const char *layer;
int selected_part;
-
uint8_t *offset_table;
-#if FF_API_EXR_GAMMA
- enum AVColorTransferCharacteristic apply_trc_type;
- float gamma;
- uint16_t gamma_table[65536];
-#endif
-
Float2HalfTables f2h_tables;
Half2FloatTables h2f_tables;
} EXRContext;
@@ -1267,10 +1259,6 @@ static int decode_block(AVCodecContext *avctx, void *tdata,
int data_xoffset, data_yoffset, data_window_offset, xsize, ysize;
int i, x, buf_size = s->buf_size;
int c, rgb_channel_count;
-#if FF_API_EXR_GAMMA
- float one_gamma = 1.0f / s->gamma;
- av_csp_trc_function trc_func = av_csp_trc_func_from_id(s->apply_trc_type);
-#endif
int ret;
line_offset = AV_RL64(s->gb.buffer + jobnr * 8);
@@ -1460,33 +1448,12 @@ static int decode_block(AVCodecContext *avctx, void *tdata,
if (s->pixel_type == EXR_FLOAT) {
// 32-bit
-#if FF_API_EXR_GAMMA
- if (trc_func && (!c || (c < 3 && s->desc->flags & AV_PIX_FMT_FLAG_PLANAR))) {
- for (int x = 0; x < xsize; x++, ptr_x += step) {
- float f = av_int2float(bytestream_get_le32(&src));
- AV_WN32A(ptr_x, av_float2int(trc_func(f)));
- }
- } else if (one_gamma != 1.f) {
- for (int x = 0; x < xsize; x++, ptr_x += step) {
- float f = av_int2float(bytestream_get_le32(&src));
- if (f > 0.0f && c < 3) /* avoid negative values */
- f = powf(f, one_gamma);
- AV_WN32A(ptr_x, av_float2int(f));
- }
- } else
-#endif
- for (int x = 0; x < xsize; x++, ptr_x += step)
- AV_WN32A(ptr_x, bytestream_get_le32(&src));
+ for (int x = 0; x < xsize; x++, ptr_x += step)
+ AV_WN32A(ptr_x, bytestream_get_le32(&src));
} else if (s->pixel_type == EXR_HALF) {
// 16-bit
-#if FF_API_EXR_GAMMA
- if (one_gamma != 1.f || (trc_func && (!c || (c < 3 && s->desc->flags & AV_PIX_FMT_FLAG_PLANAR)))) {
- for (int x = 0; x < xsize; x++, ptr_x += step)
- AV_WN16A(ptr_x, s->gamma_table[bytestream_get_le16(&src)]);
- } else
-#endif
- for (int x = 0; x < xsize; x++, ptr_x += step)
- AV_WN16A(ptr_x, bytestream_get_le16(&src));
+ for (int x = 0; x < xsize; x++, ptr_x += step)
+ AV_WN16A(ptr_x, bytestream_get_le16(&src));
}
// Zero out the end if xmax+1 is not w
@@ -2197,12 +2164,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *picture,
if (s->channel_offsets[3] >= 0)
avctx->alpha_mode = AVALPHA_MODE_PREMULTIPLIED;
-#if FF_API_EXR_GAMMA
- if (s->apply_trc_type != AVCOL_TRC_UNSPECIFIED)
- avctx->color_trc = s->apply_trc_type;
- else if (s->gamma > 0.9999f && s->gamma < 1.0001f)
-#endif
- avctx->color_trc = AVCOL_TRC_LINEAR;
+ avctx->color_trc = AVCOL_TRC_LINEAR;
switch (s->compression) {
case EXR_RAW:
@@ -2329,12 +2291,6 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *picture,
static av_cold int decode_init(AVCodecContext *avctx)
{
EXRContext *s = avctx->priv_data;
-#if FF_API_EXR_GAMMA
- uint32_t i;
- union av_intfloat32 t;
- float one_gamma = 1.0f / s->gamma;
- av_csp_trc_function trc_func = NULL;
-#endif
ff_init_float2half_tables(&s->f2h_tables);
ff_init_half2float_tables(&s->h2f_tables);
@@ -2347,28 +2303,6 @@ static av_cold int decode_init(AVCodecContext *avctx)
ff_bswapdsp_init(&s->bbdsp);
#endif
-#if FF_API_EXR_GAMMA
- trc_func = av_csp_trc_func_from_id(s->apply_trc_type);
- if (trc_func) {
- for (i = 0; i < 65536; ++i) {
- t.i = half2float(i, &s->h2f_tables);
- t.f = trc_func(t.f);
- s->gamma_table[i] = float2half(av_float2int(t.f), &s->f2h_tables);
- }
- } else if (one_gamma != 1.0f) {
- for (i = 0; i < 65536; ++i) {
- t.i = half2float(i, &s->h2f_tables);
- /* If negative value we reuse half value */
- if (t.f <= 0.0f) {
- s->gamma_table[i] = i;
- } else {
- t.f = powf(t.f, one_gamma);
- s->gamma_table[i] = float2half(t.i, &s->f2h_tables);
- }
- }
- }
-#endif
-
// allocate thread data, used for non EXR_RAW compression types
s->thread_data = av_calloc(avctx->thread_count, sizeof(*s->thread_data));
if (!s->thread_data)
@@ -2410,47 +2344,6 @@ static const AVOption options[] = {
AV_OPT_TYPE_STRING, { .str = "" }, 0, 0, VD },
{ "part", "Set the decoding part", OFFSET(selected_part),
AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, VD },
-#if FF_API_EXR_GAMMA
- { "gamma", "Set the float gamma value when decoding (deprecated, use a scaler)", OFFSET(gamma),
- AV_OPT_TYPE_FLOAT, { .dbl = 1.0f }, 0.001, FLT_MAX, VD | AV_OPT_FLAG_DEPRECATED },
-
- // XXX: Note the abuse of the enum using AVCOL_TRC_UNSPECIFIED to subsume the existing gamma option
- { "apply_trc", "color transfer characteristics to apply to EXR linear input (deprecated, use a scaler)", OFFSET(apply_trc_type),
- AV_OPT_TYPE_INT, {.i64 = AVCOL_TRC_UNSPECIFIED }, 1, AVCOL_TRC_NB-1, VD | AV_OPT_FLAG_DEPRECATED, .unit = "apply_trc_type"},
- { "bt709", "BT.709", 0,
- AV_OPT_TYPE_CONST, {.i64 = AVCOL_TRC_BT709 }, INT_MIN, INT_MAX, VD, .unit = "apply_trc_type"},
- { "gamma", "gamma", 0,
- AV_OPT_TYPE_CONST, {.i64 = AVCOL_TRC_UNSPECIFIED }, INT_MIN, INT_MAX, VD, .unit = "apply_trc_type"},
- { "gamma22", "BT.470 M", 0,
- AV_OPT_TYPE_CONST, {.i64 = AVCOL_TRC_GAMMA22 }, INT_MIN, INT_MAX, VD, .unit = "apply_trc_type"},
- { "gamma28", "BT.470 BG", 0,
- AV_OPT_TYPE_CONST, {.i64 = AVCOL_TRC_GAMMA28 }, INT_MIN, INT_MAX, VD, .unit = "apply_trc_type"},
- { "smpte170m", "SMPTE 170 M", 0,
- AV_OPT_TYPE_CONST, {.i64 = AVCOL_TRC_SMPTE170M }, INT_MIN, INT_MAX, VD, .unit = "apply_trc_type"},
- { "smpte240m", "SMPTE 240 M", 0,
- AV_OPT_TYPE_CONST, {.i64 = AVCOL_TRC_SMPTE240M }, INT_MIN, INT_MAX, VD, .unit = "apply_trc_type"},
- { "linear", "Linear", 0,
- AV_OPT_TYPE_CONST, {.i64 = AVCOL_TRC_LINEAR }, INT_MIN, INT_MAX, VD, .unit = "apply_trc_type"},
- { "log", "Log", 0,
- AV_OPT_TYPE_CONST, {.i64 = AVCOL_TRC_LOG }, INT_MIN, INT_MAX, VD, .unit = "apply_trc_type"},
- { "log_sqrt", "Log square root", 0,
- AV_OPT_TYPE_CONST, {.i64 = AVCOL_TRC_LOG_SQRT }, INT_MIN, INT_MAX, VD, .unit = "apply_trc_type"},
- { "iec61966_2_4", "IEC 61966-2-4", 0,
- AV_OPT_TYPE_CONST, {.i64 = AVCOL_TRC_IEC61966_2_4 }, INT_MIN, INT_MAX, VD, .unit = "apply_trc_type"},
- { "bt1361", "BT.1361", 0,
- AV_OPT_TYPE_CONST, {.i64 = AVCOL_TRC_BT1361_ECG }, INT_MIN, INT_MAX, VD, .unit = "apply_trc_type"},
- { "iec61966_2_1", "IEC 61966-2-1", 0,
- AV_OPT_TYPE_CONST, {.i64 = AVCOL_TRC_IEC61966_2_1 }, INT_MIN, INT_MAX, VD, .unit = "apply_trc_type"},
- { "bt2020_10bit", "BT.2020 - 10 bit", 0,
- AV_OPT_TYPE_CONST, {.i64 = AVCOL_TRC_BT2020_10 }, INT_MIN, INT_MAX, VD, .unit = "apply_trc_type"},
- { "bt2020_12bit", "BT.2020 - 12 bit", 0,
- AV_OPT_TYPE_CONST, {.i64 = AVCOL_TRC_BT2020_12 }, INT_MIN, INT_MAX, VD, .unit = "apply_trc_type"},
- { "smpte2084", "SMPTE ST 2084", 0,
- AV_OPT_TYPE_CONST, {.i64 = AVCOL_TRC_SMPTEST2084 }, INT_MIN, INT_MAX, VD, .unit = "apply_trc_type"},
- { "smpte428_1", "SMPTE ST 428-1", 0,
- AV_OPT_TYPE_CONST, {.i64 = AVCOL_TRC_SMPTEST428_1 }, INT_MIN, INT_MAX, VD, .unit = "apply_trc_type"},
-#endif
-
{ NULL },
};
diff --git a/libavcodec/version_major.h b/libavcodec/version_major.h
index e159e789c0..31ed674c0d 100644
--- a/libavcodec/version_major.h
+++ b/libavcodec/version_major.h
@@ -39,7 +39,6 @@
#define FF_API_INIT_PACKET (LIBAVCODEC_VERSION_MAJOR < 63)
-#define FF_API_EXR_GAMMA (LIBAVCODEC_VERSION_MAJOR < 63)
#define FF_API_INTRA_DC_PRECISION (LIBAVCODEC_VERSION_MAJOR < 63)
#define FF_API_MJPEG_EXTERN_HUFF (LIBAVCODEC_VERSION_MAJOR < 63)
// reminder to remove Sonic Lossy/Lossless encoders on next major bump
--
2.52.0
From 8b3e60898af821dd99845c11e9f4cee03db61c00 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
Date: Wed, 11 Mar 2026 07:09:50 +0100
Subject: [PATCH 15/33] avcodec/nvenc_h264: Remove FF_API_NVENC_H264_MAIN
I.e. switch to high profile by default.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
---
libavcodec/nvenc_h264.c | 4 ----
libavcodec/version_major.h | 2 --
2 files changed, 6 deletions(-)
diff --git a/libavcodec/nvenc_h264.c b/libavcodec/nvenc_h264.c
index 2fbd1cad87..6def749f2c 100644
--- a/libavcodec/nvenc_h264.c
+++ b/libavcodec/nvenc_h264.c
@@ -57,11 +57,7 @@ static const AVOption options[] = {
{ "ull", "Ultra low latency", 0, AV_OPT_TYPE_CONST, { .i64 = NV_ENC_TUNING_INFO_ULTRA_LOW_LATENCY }, 0, 0, VE, .unit = "tune" },
{ "lossless", "Lossless", 0, AV_OPT_TYPE_CONST, { .i64 = NV_ENC_TUNING_INFO_LOSSLESS }, 0, 0, VE, .unit = "tune" },
#endif
-#if FF_API_NVENC_H264_MAIN
- { "profile", "Set the encoding profile", OFFSET(profile), AV_OPT_TYPE_INT, { .i64 = NV_ENC_H264_PROFILE_MAIN }, NV_ENC_H264_PROFILE_BASELINE, NV_ENC_H264_PROFILE_HIGH_444P, VE, .unit = "profile" },
-#else
{ "profile", "Set the encoding profile", OFFSET(profile), AV_OPT_TYPE_INT, { .i64 = NV_ENC_H264_PROFILE_HIGH }, NV_ENC_H264_PROFILE_BASELINE, NV_ENC_H264_PROFILE_HIGH_444P, VE, .unit = "profile" },
-#endif
{ "baseline", "", 0, AV_OPT_TYPE_CONST, { .i64 = NV_ENC_H264_PROFILE_BASELINE }, 0, 0, VE, .unit = "profile" },
{ "main", "", 0, AV_OPT_TYPE_CONST, { .i64 = NV_ENC_H264_PROFILE_MAIN }, 0, 0, VE, .unit = "profile" },
{ "high", "", 0, AV_OPT_TYPE_CONST, { .i64 = NV_ENC_H264_PROFILE_HIGH }, 0, 0, VE, .unit = "profile" },
diff --git a/libavcodec/version_major.h b/libavcodec/version_major.h
index 31ed674c0d..cab80004ed 100644
--- a/libavcodec/version_major.h
+++ b/libavcodec/version_major.h
@@ -46,6 +46,4 @@
// reminder to remove Sonic decoder on next-next major bump
#define FF_CODEC_SONIC_DEC (LIBAVCODEC_VERSION_MAJOR < 63)
-#define FF_API_NVENC_H264_MAIN (LIBAVCODEC_VERSION_MAJOR < 63)
-
#endif /* AVCODEC_VERSION_MAJOR_H */
--
2.52.0
From 8d8d77994c428cb94919648916e7417cbba18f31 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
Date: Thu, 4 Jun 2026 23:39:48 +0200
Subject: [PATCH 16/33] avcodec/codec: Remove deprecated AVCodec arrays
They were deprecated in 3305767560a6303f474fffa3afb10c500059b455
on 2024-09-08. Removing them allows to constify all FFCodecs;
furthermore, it allows to use a union of a video-only and a audio-only
structure to reduce sizeof(FFCodec).
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
---
libavcodec/allcodecs.c | 50 +++----------------------------------
libavcodec/avcodec.c | 4 +--
libavcodec/codec.h | 22 ----------------
libavcodec/codec_internal.h | 29 +++++++++++++--------
libavcodec/libaomenc.c | 2 +-
libavcodec/libvpxenc.c | 2 +-
libavcodec/libx265.c | 2 +-
libavcodec/tests/avcodec.c | 29 +++++++++------------
libavcodec/tests/encinfo.c | 9 ++++++-
9 files changed, 45 insertions(+), 104 deletions(-)
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index d21712a4d8..e596443e7a 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -28,8 +28,6 @@
#include <string.h>
#include "config.h"
-#include "libavutil/thread.h"
-#include "avcodec.h"
#include "codec.h"
#include "codec_id.h"
#include "codec_internal.h"
@@ -772,7 +770,7 @@ extern const FFCodec ff_pcm_mulaw_at_encoder;
extern const FFCodec ff_pcm_mulaw_at_decoder;
extern const FFCodec ff_qdmc_at_decoder;
extern const FFCodec ff_qdm2_at_decoder;
-extern FFCodec ff_libaom_av1_encoder;
+extern const FFCodec ff_libaom_av1_encoder;
/* preferred over libaribb24 */
extern const FFCodec ff_libaribcaption_decoder;
extern const FFCodec ff_libaribb24_decoder;
@@ -819,7 +817,7 @@ extern const FFCodec ff_libvorbis_encoder;
extern const FFCodec ff_libvorbis_decoder;
extern const FFCodec ff_libvpx_vp8_encoder;
extern const FFCodec ff_libvpx_vp8_decoder;
-extern FFCodec ff_libvpx_vp9_encoder;
+extern const FFCodec ff_libvpx_vp9_encoder;
extern const FFCodec ff_libvpx_vp9_decoder;
extern const FFCodec ff_libvvenc_encoder;
/* preferred over libwebp */
@@ -828,7 +826,7 @@ extern const FFCodec ff_libwebp_encoder;
extern const FFCodec ff_libx262_encoder;
extern const FFCodec ff_libx264_encoder;
extern const FFCodec ff_libx264rgb_encoder;
-extern FFCodec ff_libx265_encoder;
+extern const FFCodec ff_libx265_encoder;
extern const FFCodec ff_libxeve_encoder;
extern const FFCodec ff_libxevd_decoder;
extern const FFCodec ff_libxavs_encoder;
@@ -943,53 +941,11 @@ const FFCodec * codec_list[] = {
#include "libavcodec/codec_list.c"
#endif
-static AVOnce av_codec_static_init = AV_ONCE_INIT;
-static void av_codec_init_static(void)
-{
- int dummy;
- for (int i = 0; codec_list[i]; i++) {
- /* Backward compatibility with deprecated public fields */
- const FFCodec *codec = codec_list[i];
- if (!codec->get_supported_config)
- continue;
-
-FF_DISABLE_DEPRECATION_WARNINGS
- switch (codec->p.type) {
- case AVMEDIA_TYPE_VIDEO:
- if (!codec->p.pix_fmts)
- codec->get_supported_config(NULL, &codec->p,
- AV_CODEC_CONFIG_PIX_FORMAT, 0,
- (const void **) &codec->p.pix_fmts,
- &dummy);
- break;
- case AVMEDIA_TYPE_AUDIO:
- codec->get_supported_config(NULL, &codec->p,
- AV_CODEC_CONFIG_SAMPLE_FORMAT, 0,
- (const void **) &codec->p.sample_fmts,
- &dummy);
- codec->get_supported_config(NULL, &codec->p,
- AV_CODEC_CONFIG_SAMPLE_RATE, 0,
- (const void **) &codec->p.supported_samplerates,
- &dummy);
- codec->get_supported_config(NULL, &codec->p,
- AV_CODEC_CONFIG_CHANNEL_LAYOUT, 0,
- (const void **) &codec->p.ch_layouts,
- &dummy);
- break;
- default:
- break;
- }
-FF_ENABLE_DEPRECATION_WARNINGS
- }
-}
-
const AVCodec *av_codec_iterate(void **opaque)
{
uintptr_t i = (uintptr_t)*opaque;
const FFCodec *c = codec_list[i];
- ff_thread_once(&av_codec_static_init, av_codec_init_static);
-
if (c) {
*opaque = (void*)(i + 1);
return &c->p;
diff --git a/libavcodec/avcodec.c b/libavcodec/avcodec.c
index 23ccac1a85..5320dfc06c 100644
--- a/libavcodec/avcodec.c
+++ b/libavcodec/avcodec.c
@@ -726,7 +726,7 @@ int avcodec_receive_frame(AVCodecContext *avctx, AVFrame *frame)
do { \
if (codec->type != (allowed_type)) \
return AVERROR(EINVAL); \
- const field_type *ptr = codec->field; \
+ const field_type *ptr = codec2->field; \
*out_configs = ptr; \
if (ptr) { \
for (int i = 0;; i++) { \
@@ -772,7 +772,6 @@ int ff_default_get_supported_config(const AVCodecContext *avctx,
const FFCodec *codec2 = ffcodec(codec);
switch (config) {
-FF_DISABLE_DEPRECATION_WARNINGS
case AV_CODEC_CONFIG_PIX_FORMAT:
WRAP_CONFIG(AVMEDIA_TYPE_VIDEO, pix_fmts, pix_fmt, enum AVPixelFormat, pix_fmt == AV_PIX_FMT_NONE);
case AV_CODEC_CONFIG_FRAME_RATE:
@@ -783,7 +782,6 @@ FF_DISABLE_DEPRECATION_WARNINGS
WRAP_CONFIG(AVMEDIA_TYPE_AUDIO, sample_fmts, sample_fmt, enum AVSampleFormat, sample_fmt == AV_SAMPLE_FMT_NONE);
case AV_CODEC_CONFIG_CHANNEL_LAYOUT:
WRAP_CONFIG(AVMEDIA_TYPE_AUDIO, ch_layouts, ch_layout, AVChannelLayout, ch_layout.nb_channels == 0);
-FF_ENABLE_DEPRECATION_WARNINGS
case AV_CODEC_CONFIG_COLOR_RANGE:
if (codec->type != AVMEDIA_TYPE_VIDEO)
diff --git a/libavcodec/codec.h b/libavcodec/codec.h
index f509e5d94e..0966d2e616 100644
--- a/libavcodec/codec.h
+++ b/libavcodec/codec.h
@@ -27,11 +27,8 @@
#include "libavutil/hwcontext.h"
#include "libavutil/log.h"
#include "libavutil/pixfmt.h"
-#include "libavutil/rational.h"
-#include "libavutil/samplefmt.h"
#include "libavcodec/codec_id.h"
-#include "libavcodec/version_major.h"
/**
* @addtogroup lavc_core
@@ -191,18 +188,6 @@ typedef struct AVCodec {
int capabilities;
uint8_t max_lowres; ///< maximum value for lowres supported by the decoder
- /**
- * Deprecated codec capabilities.
- */
- attribute_deprecated
- const AVRational *supported_framerates; ///< @deprecated use avcodec_get_supported_config()
- attribute_deprecated
- const enum AVPixelFormat *pix_fmts; ///< @deprecated use avcodec_get_supported_config()
- attribute_deprecated
- const int *supported_samplerates; ///< @deprecated use avcodec_get_supported_config()
- attribute_deprecated
- const enum AVSampleFormat *sample_fmts; ///< @deprecated use avcodec_get_supported_config()
-
const AVClass *priv_class; ///< AVClass for the private context
const AVProfile *profiles; ///< array of recognized profiles, or NULL if unknown, array is terminated by {AV_PROFILE_UNKNOWN}
@@ -217,13 +202,6 @@ typedef struct AVCodec {
* (usually AVCodec.name will be of the form "<codec_name>_<wrapper_name>").
*/
const char *wrapper_name;
-
- /**
- * Array of supported channel layouts, terminated with a zeroed layout.
- * @deprecated use avcodec_get_supported_config()
- */
- attribute_deprecated
- const AVChannelLayout *ch_layouts;
} AVCodec;
/**
diff --git a/libavcodec/codec_internal.h b/libavcodec/codec_internal.h
index 720788210d..5cb65a06e2 100644
--- a/libavcodec/codec_internal.h
+++ b/libavcodec/codec_internal.h
@@ -285,6 +285,23 @@ typedef struct FFCodec {
unsigned flags,
const void **out_configs,
int *out_num_configs);
+#if defined(ASSERT_LEVEL) && ASSERT_LEVEL >= 2
+ struct {
+#else
+ union {
+#endif
+ /// Video-only fields
+ struct {
+ const AVRational *supported_framerates;
+ const enum AVPixelFormat *pix_fmts;
+ };
+ /// Audio-only fields
+ struct {
+ const AVChannelLayout *ch_layouts;
+ const int *supported_samplerates;
+ const enum AVSampleFormat *sample_fmts;
+ };
+ };
} FFCodec;
static av_always_inline const FFCodec *ffcodec(const AVCodec *codec)
@@ -369,14 +386,6 @@ int ff_default_get_supported_config(const struct AVCodecContext *avctx,
.cb_type = FF_CODEC_CB_TYPE_RECEIVE_PACKET, \
.cb.receive_packet = (func)
-#ifdef __clang__
-#define DISABLE_DEPRECATION_WARNINGS FF_DISABLE_DEPRECATION_WARNINGS
-#define ENABLE_DEPRECATION_WARNINGS FF_ENABLE_DEPRECATION_WARNINGS
-#else
-#define DISABLE_DEPRECATION_WARNINGS
-#define ENABLE_DEPRECATION_WARNINGS
-#endif
-
#define CODEC_CH_LAYOUTS(...) CODEC_CH_LAYOUTS_ARRAY(((const AVChannelLayout[]) { __VA_ARGS__, { 0 } }))
#define CODEC_CH_LAYOUTS_ARRAY(array) CODEC_ARRAY(ch_layouts, (array))
@@ -393,8 +402,6 @@ int ff_default_get_supported_config(const struct AVCodecContext *avctx,
#define CODEC_PIXFMTS_ARRAY(array) CODEC_ARRAY(pix_fmts, (array))
#define CODEC_ARRAY(field, array) \
- DISABLE_DEPRECATION_WARNINGS \
- .p.field = (array) \
- ENABLE_DEPRECATION_WARNINGS
+ .field = (array) \
#endif /* AVCODEC_CODEC_INTERNAL_H */
diff --git a/libavcodec/libaomenc.c b/libavcodec/libaomenc.c
index b6877401f0..7cabea3003 100644
--- a/libavcodec/libaomenc.c
+++ b/libavcodec/libaomenc.c
@@ -1622,7 +1622,7 @@ static const AVClass class_aom = {
.version = LIBAVUTIL_VERSION_INT,
};
-FFCodec ff_libaom_av1_encoder = {
+const FFCodec ff_libaom_av1_encoder = {
.p.name = "libaom-av1",
CODEC_LONG_NAME("libaom AV1"),
.p.type = AVMEDIA_TYPE_VIDEO,
diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c
index 963fa6c619..942e28dd73 100644
--- a/libavcodec/libvpxenc.c
+++ b/libavcodec/libvpxenc.c
@@ -2214,7 +2214,7 @@ static const AVClass class_vp9 = {
.version = LIBAVUTIL_VERSION_INT,
};
-FFCodec ff_libvpx_vp9_encoder = {
+const FFCodec ff_libvpx_vp9_encoder = {
.p.name = "libvpx-vp9",
CODEC_LONG_NAME("libvpx VP9"),
.p.type = AVMEDIA_TYPE_VIDEO,
diff --git a/libavcodec/libx265.c b/libavcodec/libx265.c
index 7d488c0f4b..c5e6b8c150 100644
--- a/libavcodec/libx265.c
+++ b/libavcodec/libx265.c
@@ -1081,7 +1081,7 @@ static const FFCodecDefault x265_defaults[] = {
{ NULL },
};
-FFCodec ff_libx265_encoder = {
+const FFCodec ff_libx265_encoder = {
.p.name = "libx265",
CODEC_LONG_NAME("libx265 H.265 / HEVC"),
.p.type = AVMEDIA_TYPE_VIDEO,
diff --git a/libavcodec/tests/avcodec.c b/libavcodec/tests/avcodec.c
index ea7e1bada5..c9afec4eb6 100644
--- a/libavcodec/tests/avcodec.c
+++ b/libavcodec/tests/avcodec.c
@@ -58,7 +58,7 @@ static int priv_data_size_wrong(const FFCodec *codec)
#define ARRAY_CHECK(field, var, type, is_sentinel, check, sentinel_check) \
do { \
- const type *ptr = codec->field; \
+ const type *ptr = codec2->field; \
if (!ptr) \
break; \
type var = *ptr; \
@@ -102,17 +102,16 @@ int main(void){
ERR_EXT("Codec %s has unsupported type %s\n",
get_type_string(codec->type));
if (codec->type != AVMEDIA_TYPE_AUDIO) {
-FF_DISABLE_DEPRECATION_WARNINGS
- if (codec->ch_layouts || codec->sample_fmts ||
- codec->supported_samplerates)
+#if defined(ASSERT_LEVEL) && ASSERT_LEVEL >= 2
+ if (codec2->ch_layouts || codec2->sample_fmts ||
+ codec2->supported_samplerates)
ERR("Non-audio codec %s has audio-only fields set\n");
-FF_ENABLE_DEPRECATION_WARNINGS
+#endif
if (codec->capabilities & (AV_CODEC_CAP_SMALL_LAST_FRAME |
AV_CODEC_CAP_CHANNEL_CONF |
AV_CODEC_CAP_VARIABLE_FRAME_SIZE))
ERR("Non-audio codec %s has audio-only capabilities set\n");
} else {
-FF_DISABLE_DEPRECATION_WARNINGS
ARRAY_CHECK(supported_samplerates, sample_rate, int, sample_rate == 0,
sample_rate > 0, 1);
ARRAY_CHECK(sample_fmts, sample_fmt, enum AVSampleFormat, sample_fmt == AV_SAMPLE_FMT_NONE,
@@ -120,14 +119,14 @@ FF_DISABLE_DEPRECATION_WARNINGS
static const AVChannelLayout zero_channel_layout = { 0 };
ARRAY_CHECK(ch_layouts, ch_layout, AVChannelLayout, ch_layout.nb_channels == 0,
av_channel_layout_check(&ch_layout), !memcmp(ptr, &zero_channel_layout, sizeof(ch_layout)));
-FF_ENABLE_DEPRECATION_WARNINGS
}
if (codec->type != AVMEDIA_TYPE_VIDEO) {
-FF_DISABLE_DEPRECATION_WARNINGS
- if (codec->pix_fmts || codec->supported_framerates ||
- codec2->color_ranges || codec2->alpha_modes)
+ if (codec2->color_ranges ||
+#if defined(ASSERT_LEVEL) && ASSERT_LEVEL >= 2
+ codec2->pix_fmts || codec2->supported_framerates ||
+#endif
+ codec2->alpha_modes)
ERR("Non-video codec %s has video-only fields set\n");
-FF_ENABLE_DEPRECATION_WARNINGS
if (codec2->caps_internal & FF_CODEC_CAP_EXPORTS_CROPPING)
ERR("Non-video codec %s exports cropping\n");
}
@@ -176,8 +175,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
if (codec2->update_thread_context || codec2->update_thread_context_for_user || codec2->bsfs)
ERR("Encoder %s has decoder-only thread functions or bsf.\n");
if (codec->type == AVMEDIA_TYPE_AUDIO) {
-FF_DISABLE_DEPRECATION_WARNINGS
- if (!codec->sample_fmts) {
+ if (!codec2->sample_fmts) {
av_log(NULL, AV_LOG_FATAL, "Encoder %s is missing the sample_fmts field\n", codec->name);
ret = 1;
}
@@ -186,7 +184,6 @@ FF_DISABLE_DEPRECATION_WARNINGS
av_pix_fmt_desc_get(pix_fmt), 1);
ARRAY_CHECK(supported_framerates, framerate, AVRational, framerate.num == 0,
framerate.num > 0 && framerate.den > 0, framerate.den == 0);
-FF_ENABLE_DEPRECATION_WARNINGS
}
if (codec2->caps_internal & (FF_CODEC_CAP_USES_PROGRESSFRAMES |
FF_CODEC_CAP_SETS_PKT_DTS |
@@ -225,10 +222,8 @@ FF_ENABLE_DEPRECATION_WARNINGS
codec2->caps_internal & FF_CODEC_CAP_SETS_PKT_DTS)
ERR("Decoder %s is marked as setting pkt_dts when it doesn't have"
"any effect\n");
-FF_DISABLE_DEPRECATION_WARNINGS
- if (codec->type == AVMEDIA_TYPE_VIDEO && (codec->pix_fmts || codec->supported_framerates))
+ if (codec->type == AVMEDIA_TYPE_VIDEO && (codec2->pix_fmts || codec2->supported_framerates))
ERR("Decoder %s sets pix_fmts or supported_framerates.\n");
-FF_ENABLE_DEPRECATION_WARNINGS
}
if (priv_data_size_wrong(codec2))
ERR_EXT("Private context of codec %s is impossibly-sized (size %d).",
diff --git a/libavcodec/tests/encinfo.c b/libavcodec/tests/encinfo.c
index a24d769cd3..32bd3ec2bb 100644
--- a/libavcodec/tests/encinfo.c
+++ b/libavcodec/tests/encinfo.c
@@ -60,7 +60,14 @@ int main(int argc, char **argv)
return AVERROR(ENOMEM);
ctx->sample_rate = sample_rate;
- ctx->sample_fmt = codec->sample_fmts ? codec->sample_fmts[0] : AV_SAMPLE_FMT_S16;
+ const void *sample_fmts;
+ ret = avcodec_get_supported_config(ctx, NULL, AV_CODEC_CONFIG_SAMPLE_FORMAT, 0, &sample_fmts, NULL);
+ if (ret < 0) {
+ fprintf(stderr, "avcodec_get_supported_config failed: %d\n", ret);
+ avcodec_free_context(&ctx);
+ return 1;
+ }
+ ctx->sample_fmt = sample_fmts ? *(const enum AVSampleFormat*)sample_fmts : AV_SAMPLE_FMT_S16;
av_channel_layout_default(&ctx->ch_layout, channels);
ret = avcodec_open2(ctx, codec, NULL);
--
2.52.0
From 78c54780ff2a90fc0d703cee03048d265a3d5ffe Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
Date: Mon, 9 Mar 2026 05:57:19 +0100
Subject: [PATCH 17/33] avcodec/exif: Remove avpriv_exif_decode_ifd()
Superseded by the public exif API.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
---
libavcodec/exif.c | 17 -----------------
libavcodec/exif_internal.h | 7 -------
2 files changed, 24 deletions(-)
diff --git a/libavcodec/exif.c b/libavcodec/exif.c
index 0e97ad690b..b188081801 100644
--- a/libavcodec/exif.c
+++ b/libavcodec/exif.c
@@ -1055,23 +1055,6 @@ int av_exif_ifd_to_dict(void *logctx, const AVExifMetadata *ifd, AVDictionary **
return exif_ifd_to_dict(logctx, "", ifd, metadata);
}
-#if LIBAVCODEC_VERSION_MAJOR < 63
-int avpriv_exif_decode_ifd(void *logctx, const uint8_t *buf, int size,
- int le, int depth, AVDictionary **metadata)
-{
- AVExifMetadata ifd = { 0 };
- GetByteContext gb;
- int ret;
- bytestream2_init(&gb, buf, size);
- ret = exif_parse_ifd_list(logctx, &gb, le, depth, &ifd, 0);
- if (ret < 0)
- return ret;
- ret = av_exif_ifd_to_dict(logctx, &ifd, metadata);
- av_exif_free(&ifd);
- return ret;
-}
-#endif
-
#define EXIF_COPY(fname, srcname) do { \
size_t sz; \
if (av_size_mult(src->count, sizeof(*(fname)), &sz) < 0) { \
diff --git a/libavcodec/exif_internal.h b/libavcodec/exif_internal.h
index 7fd593ce81..68abca03ba 100644
--- a/libavcodec/exif_internal.h
+++ b/libavcodec/exif_internal.h
@@ -34,13 +34,6 @@
#include "libavutil/frame.h"
#include "exif.h"
-#include "version_major.h"
-
-#if LIBAVCODEC_VERSION_MAJOR < 63
-/* Used by the AVI demuxer */
-int avpriv_exif_decode_ifd(void *logctx, const uint8_t *buf, int size,
- int le, int depth, AVDictionary **metadata);
-#endif
/**
* Compares values in the IFD with data in the provided AVFrame and sets the values
--
2.52.0
From 3d40c90728cad4811d2ed2d77acd7404a858b731 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
Date: Sun, 3 May 2026 11:44:46 +0200
Subject: [PATCH 18/33] avcodec/packet: Remove AVPacketList
Deprecated in f7db77bd8785d1715d3e7ed7e69bd1cc991f2d07
on 2021-03-17.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
---
libavcodec/packet.h | 8 --------
1 file changed, 8 deletions(-)
diff --git a/libavcodec/packet.h b/libavcodec/packet.h
index b1a0c3ae57..61569e3d4d 100644
--- a/libavcodec/packet.h
+++ b/libavcodec/packet.h
@@ -647,14 +647,6 @@ typedef struct AVPacket {
AVRational time_base;
} AVPacket;
-#if FF_API_INIT_PACKET
-attribute_deprecated
-typedef struct AVPacketList {
- AVPacket pkt;
- struct AVPacketList *next;
-} AVPacketList;
-#endif
-
#define AV_PKT_FLAG_KEY 0x0001 ///< The packet contains a keyframe
#define AV_PKT_FLAG_CORRUPT 0x0002 ///< The packet content is corrupted
/**
--
2.52.0
From 357cc1bca4beb322055e392963a409885553d35b Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
Date: Sun, 3 May 2026 11:55:55 +0200
Subject: [PATCH 19/33] avcodec/packet: Accept const dictionaries in
av_packet_pack_dictionary()
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
---
doc/APIchanges | 3 +++
libavcodec/packet.c | 2 +-
libavcodec/packet.h | 2 +-
libavcodec/version.h | 4 ++--
4 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/doc/APIchanges b/doc/APIchanges
index baba5918e6..02252e372a 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -2,6 +2,9 @@ The last version increases of all libraries were on 2025-03-28
API changes, most recent first:
+2026-06-12 - xxxxxxxxxx - lavc 62.37.100 - packet.h
+ av_packet_pack_dictionary() now accepts const AVDictionary*.
+
2026-06-xx - xxxxxxxxxx - lavu 60.33.100 - frame.h
Add AV_FRAME_DATA_RAW_COLOR_PARAMS.
diff --git a/libavcodec/packet.c b/libavcodec/packet.c
index 80549eb48b..deb369ff05 100644
--- a/libavcodec/packet.c
+++ b/libavcodec/packet.c
@@ -316,7 +316,7 @@ const char *av_packet_side_data_name(enum AVPacketSideDataType type)
return NULL;
}
-uint8_t *av_packet_pack_dictionary(AVDictionary *dict, size_t *size)
+uint8_t *av_packet_pack_dictionary(const AVDictionary *dict, size_t *size)
{
uint8_t *data = NULL;
*size = 0;
diff --git a/libavcodec/packet.h b/libavcodec/packet.h
index 61569e3d4d..00774a7030 100644
--- a/libavcodec/packet.h
+++ b/libavcodec/packet.h
@@ -824,7 +824,7 @@ uint8_t* av_packet_get_side_data(const AVPacket *pkt, enum AVPacketSideDataType
* @param size pointer to store the size of the returned data
* @return pointer to data if successful, NULL otherwise
*/
-uint8_t *av_packet_pack_dictionary(AVDictionary *dict, size_t *size);
+uint8_t *av_packet_pack_dictionary(const AVDictionary *dict, size_t *size);
/**
* Unpack a dictionary from side_data.
*
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 381b278e81..376388c5bb 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -29,8 +29,8 @@
#include "version_major.h"
-#define LIBAVCODEC_VERSION_MINOR 36
-#define LIBAVCODEC_VERSION_MICRO 101
+#define LIBAVCODEC_VERSION_MINOR 37
+#define LIBAVCODEC_VERSION_MICRO 100
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
LIBAVCODEC_VERSION_MINOR, \
--
2.52.0
From de8411fc007112ede913af83fe3e7fa6e6e29746 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
Date: Mon, 9 Mar 2026 06:30:48 +0100
Subject: [PATCH 20/33] avutil/common: Remove FF_API_MOD_UINTP2
Deprecated on 2024-06-13.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
---
libavutil/common.h | 11 -----------
libavutil/version.h | 1 -
2 files changed, 12 deletions(-)
diff --git a/libavutil/common.h b/libavutil/common.h
index bf23aa50b0..cba78c5fd8 100644
--- a/libavutil/common.h
+++ b/libavutil/common.h
@@ -297,17 +297,6 @@ static av_always_inline av_const unsigned av_zero_extend_c(unsigned a, unsigned
return a & ((1U << p) - 1);
}
-#if FF_API_MOD_UINTP2
-#ifndef av_mod_uintp2
-# define av_mod_uintp2 av_mod_uintp2_c
-#endif
-attribute_deprecated
-static av_always_inline av_const unsigned av_mod_uintp2_c(unsigned a, unsigned p)
-{
- return av_zero_extend_c(a, p);
-}
-#endif
-
/**
* Add two signed 32-bit values with saturation.
*
diff --git a/libavutil/version.h b/libavutil/version.h
index 429e65d77f..8e046a4287 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -105,7 +105,6 @@
* @{
*/
-#define FF_API_MOD_UINTP2 (LIBAVUTIL_VERSION_MAJOR < 61)
#define FF_API_RISCV_FD_ZBA (LIBAVUTIL_VERSION_MAJOR < 61)
#define FF_API_VULKAN_FIXED_QUEUES (LIBAVUTIL_VERSION_MAJOR < 61)
#define FF_API_OPT_INT_LIST (LIBAVUTIL_VERSION_MAJOR < 61)
--
2.52.0
From ddce58f6b5aec03ffb0b642d417459a87614e31a Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
Date: Mon, 9 Mar 2026 06:34:05 +0100
Subject: [PATCH 21/33] avutil/cpu: Remove FF_API_RISCV_FD_ZBA
Deprecated on 2024-08-05.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
---
libavutil/cpu.h | 7 -------
libavutil/version.h | 1 -
2 files changed, 8 deletions(-)
diff --git a/libavutil/cpu.h b/libavutil/cpu.h
index 07076dafb8..c41686344f 100644
--- a/libavutil/cpu.h
+++ b/libavutil/cpu.h
@@ -94,18 +94,11 @@
// RISC-V extensions
#define AV_CPU_FLAG_RVI (1 << 0) ///< I (full GPR bank)
-#if FF_API_RISCV_FD_ZBA
-#define AV_CPU_FLAG_RVF (1 << 1) ///< F (single precision FP)
-#define AV_CPU_FLAG_RVD (1 << 2) ///< D (double precision FP)
-#endif
#define AV_CPU_FLAG_RVV_I32 (1 << 3) ///< Vectors of 8/16/32-bit int's */
#define AV_CPU_FLAG_RVV_F32 (1 << 4) ///< Vectors of float's */
#define AV_CPU_FLAG_RVV_I64 (1 << 5) ///< Vectors of 64-bit int's */
#define AV_CPU_FLAG_RVV_F64 (1 << 6) ///< Vectors of double's
#define AV_CPU_FLAG_RVB_BASIC (1 << 7) ///< Basic bit-manipulations
-#if FF_API_RISCV_FD_ZBA
-#define AV_CPU_FLAG_RVB_ADDR (1 << 8) ///< Address bit-manipulations
-#endif
#define AV_CPU_FLAG_RV_ZVBB (1 << 9) ///< Vector basic bit-manipulations
#define AV_CPU_FLAG_RV_MISALIGNED (1 <<10) ///< Fast misaligned accesses
#define AV_CPU_FLAG_RVB (1 <<11) ///< B (bit manipulations)
diff --git a/libavutil/version.h b/libavutil/version.h
index 8e046a4287..1956eeabba 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -105,7 +105,6 @@
* @{
*/
-#define FF_API_RISCV_FD_ZBA (LIBAVUTIL_VERSION_MAJOR < 61)
#define FF_API_VULKAN_FIXED_QUEUES (LIBAVUTIL_VERSION_MAJOR < 61)
#define FF_API_OPT_INT_LIST (LIBAVUTIL_VERSION_MAJOR < 61)
#define FF_API_OPT_PTR (LIBAVUTIL_VERSION_MAJOR < 61)
--
2.52.0
From 2225b6f95b1205cb809a94fb26b7ccb6662a2aa6 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
Date: Mon, 9 Mar 2026 06:36:57 +0100
Subject: [PATCH 22/33] avutil/hwcontext_vulkan: Remove
FF_API_VULKAN_FIXED_QUEUES
Deprecated on 2024-08-11.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
---
libavutil/hwcontext_vulkan.c | 101 -----------------------------------
libavutil/hwcontext_vulkan.h | 52 ------------------
libavutil/version.h | 1 -
3 files changed, 154 deletions(-)
diff --git a/libavutil/hwcontext_vulkan.c b/libavutil/hwcontext_vulkan.c
index 17380a22c0..20b6ed46f8 100644
--- a/libavutil/hwcontext_vulkan.c
+++ b/libavutil/hwcontext_vulkan.c
@@ -1741,35 +1741,6 @@ static int setup_queue_families(AVHWDeviceContext *ctx, VkDeviceCreateInfo *cd)
};
}
-#if FF_API_VULKAN_FIXED_QUEUES
-FF_DISABLE_DEPRECATION_WARNINGS
- /* Setup deprecated fields */
- hwctx->queue_family_index = -1;
- hwctx->queue_family_comp_index = -1;
- hwctx->queue_family_tx_index = -1;
- hwctx->queue_family_encode_index = -1;
- hwctx->queue_family_decode_index = -1;
-
-#define SET_OLD_QF(field, nb_field, type) \
- do { \
- if (field < 0 && hwctx->qf[i].flags & type) { \
- field = hwctx->qf[i].idx; \
- nb_field = hwctx->qf[i].num; \
- } \
- } while (0)
-
- for (uint32_t i = 0; i < hwctx->nb_qf; i++) {
- SET_OLD_QF(hwctx->queue_family_index, hwctx->nb_graphics_queues, VK_QUEUE_GRAPHICS_BIT);
- SET_OLD_QF(hwctx->queue_family_comp_index, hwctx->nb_comp_queues, VK_QUEUE_COMPUTE_BIT);
- SET_OLD_QF(hwctx->queue_family_tx_index, hwctx->nb_tx_queues, VK_QUEUE_TRANSFER_BIT);
- SET_OLD_QF(hwctx->queue_family_encode_index, hwctx->nb_encode_queues, VK_QUEUE_VIDEO_ENCODE_BIT_KHR);
- SET_OLD_QF(hwctx->queue_family_decode_index, hwctx->nb_decode_queues, VK_QUEUE_VIDEO_DECODE_BIT_KHR);
- }
-
-#undef SET_OLD_QF
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif
-
return 0;
}
@@ -1947,7 +1918,6 @@ static int vulkan_device_init(AVHWDeviceContext *ctx)
VkQueueFamilyProperties2 *qf;
VkQueueFamilyVideoPropertiesKHR *qf_vid;
VkPhysicalDeviceExternalSemaphoreInfo ext_sem_props_info;
- int graph_index, comp_index, tx_index, enc_index, dec_index;
/* Set device extension flags */
for (int i = 0; i < hwctx->nb_enabled_dev_extensions; i++) {
@@ -2060,77 +2030,6 @@ static int vulkan_device_init(AVHWDeviceContext *ctx)
}
}
-#if FF_API_VULKAN_FIXED_QUEUES
-FF_DISABLE_DEPRECATION_WARNINGS
- graph_index = hwctx->nb_graphics_queues ? hwctx->queue_family_index : -1;
- comp_index = hwctx->nb_comp_queues ? hwctx->queue_family_comp_index : -1;
- tx_index = hwctx->nb_tx_queues ? hwctx->queue_family_tx_index : -1;
- dec_index = hwctx->nb_decode_queues ? hwctx->queue_family_decode_index : -1;
- enc_index = hwctx->nb_encode_queues ? hwctx->queue_family_encode_index : -1;
-
-#define CHECK_QUEUE(type, required, fidx, ctx_qf, qc) \
- do { \
- if (ctx_qf < 0 && required) { \
- av_log(ctx, AV_LOG_ERROR, "%s queue family is required, but marked as missing" \
- " in the context!\n", type); \
- err = AVERROR(EINVAL); \
- goto end; \
- } else if (fidx < 0 || ctx_qf < 0) { \
- break; \
- } else if (ctx_qf >= qf_num) { \
- av_log(ctx, AV_LOG_ERROR, "Invalid %s family index %i (device has %i families)!\n", \
- type, ctx_qf, qf_num); \
- err = AVERROR(EINVAL); \
- goto end; \
- } \
- \
- av_log(ctx, AV_LOG_VERBOSE, "Using queue family %i (queues: %i)" \
- " for%s%s%s%s%s\n", \
- ctx_qf, qc, \
- ctx_qf == graph_index ? " graphics" : "", \
- ctx_qf == comp_index ? " compute" : "", \
- ctx_qf == tx_index ? " transfers" : "", \
- ctx_qf == enc_index ? " encode" : "", \
- ctx_qf == dec_index ? " decode" : ""); \
- graph_index = (ctx_qf == graph_index) ? -1 : graph_index; \
- comp_index = (ctx_qf == comp_index) ? -1 : comp_index; \
- tx_index = (ctx_qf == tx_index) ? -1 : tx_index; \
- enc_index = (ctx_qf == enc_index) ? -1 : enc_index; \
- dec_index = (ctx_qf == dec_index) ? -1 : dec_index; \
- } while (0)
-
- CHECK_QUEUE("graphics", 0, graph_index, hwctx->queue_family_index, hwctx->nb_graphics_queues);
- CHECK_QUEUE("compute", 1, comp_index, hwctx->queue_family_comp_index, hwctx->nb_comp_queues);
- CHECK_QUEUE("upload", 1, tx_index, hwctx->queue_family_tx_index, hwctx->nb_tx_queues);
- CHECK_QUEUE("decode", 0, dec_index, hwctx->queue_family_decode_index, hwctx->nb_decode_queues);
- CHECK_QUEUE("encode", 0, enc_index, hwctx->queue_family_encode_index, hwctx->nb_encode_queues);
-
-#undef CHECK_QUEUE
-
- /* Update the new queue family fields. If non-zero already,
- * it means API users have set it. */
- if (!hwctx->nb_qf) {
-#define ADD_QUEUE(ctx_qf, qc, flag) \
- do { \
- if (ctx_qf != -1) { \
- hwctx->qf[hwctx->nb_qf++] = (AVVulkanDeviceQueueFamily) { \
- .idx = ctx_qf, \
- .num = qc, \
- .flags = flag, \
- }; \
- } \
- } while (0)
-
- ADD_QUEUE(hwctx->queue_family_index, hwctx->nb_graphics_queues, VK_QUEUE_GRAPHICS_BIT);
- ADD_QUEUE(hwctx->queue_family_comp_index, hwctx->nb_comp_queues, VK_QUEUE_COMPUTE_BIT);
- ADD_QUEUE(hwctx->queue_family_tx_index, hwctx->nb_tx_queues, VK_QUEUE_TRANSFER_BIT);
- ADD_QUEUE(hwctx->queue_family_decode_index, hwctx->nb_decode_queues, VK_QUEUE_VIDEO_DECODE_BIT_KHR);
- ADD_QUEUE(hwctx->queue_family_encode_index, hwctx->nb_encode_queues, VK_QUEUE_VIDEO_ENCODE_BIT_KHR);
-#undef ADD_QUEUE
- }
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif
-
for (int i = 0; i < hwctx->nb_qf; i++) {
if (!hwctx->qf[i].video_caps &&
hwctx->qf[i].flags & (VK_QUEUE_VIDEO_DECODE_BIT_KHR |
diff --git a/libavutil/hwcontext_vulkan.h b/libavutil/hwcontext_vulkan.h
index 2bd6d50198..8944d54344 100644
--- a/libavutil/hwcontext_vulkan.h
+++ b/libavutil/hwcontext_vulkan.h
@@ -116,58 +116,6 @@ typedef struct AVVulkanDeviceContext {
const char * const *enabled_dev_extensions;
int nb_enabled_dev_extensions;
-#if FF_API_VULKAN_FIXED_QUEUES
- /**
- * Queue family index for graphics operations, and the number of queues
- * enabled for it. If unavailable, will be set to -1. Not required.
- * av_hwdevice_create() will attempt to find a dedicated queue for each
- * queue family, or pick the one with the least unrelated flags set.
- * Queue indices here may overlap if a queue has to share capabilities.
- */
- attribute_deprecated
- int queue_family_index;
- attribute_deprecated
- int nb_graphics_queues;
-
- /**
- * Queue family index for transfer operations and the number of queues
- * enabled. Required.
- */
- attribute_deprecated
- int queue_family_tx_index;
- attribute_deprecated
- int nb_tx_queues;
-
- /**
- * Queue family index for compute operations and the number of queues
- * enabled. Required.
- */
- attribute_deprecated
- int queue_family_comp_index;
- attribute_deprecated
- int nb_comp_queues;
-
- /**
- * Queue family index for video encode ops, and the amount of queues enabled.
- * If the device doesn't support such, queue_family_encode_index will be -1.
- * Not required.
- */
- attribute_deprecated
- int queue_family_encode_index;
- attribute_deprecated
- int nb_encode_queues;
-
- /**
- * Queue family index for video decode ops, and the amount of queues enabled.
- * If the device doesn't support such, queue_family_decode_index will be -1.
- * Not required.
- */
- attribute_deprecated
- int queue_family_decode_index;
- attribute_deprecated
- int nb_decode_queues;
-#endif
-
#if FF_API_VULKAN_SYNC_QUEUES
/**
* Locks a queue, preventing other threads from submitting any command
diff --git a/libavutil/version.h b/libavutil/version.h
index 1956eeabba..331fbc32b3 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -105,7 +105,6 @@
* @{
*/
-#define FF_API_VULKAN_FIXED_QUEUES (LIBAVUTIL_VERSION_MAJOR < 61)
#define FF_API_OPT_INT_LIST (LIBAVUTIL_VERSION_MAJOR < 61)
#define FF_API_OPT_PTR (LIBAVUTIL_VERSION_MAJOR < 61)
#define FF_API_CPU_FLAG_FORCE (LIBAVUTIL_VERSION_MAJOR < 61)
--
2.52.0
From f4afd1b74366b3da2af0b5cfc86b8752eaa437fd Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
Date: Mon, 9 Mar 2026 06:41:36 +0100
Subject: [PATCH 23/33] avutil: Remove FF_API_OPT_INT_LIST
Deprecated on 2024-09-30.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
---
fftools/textformat/avtextformat.c | 6 ++++--
fftools/textformat/tf_compact.c | 4 ++--
fftools/textformat/tf_default.c | 3 ++-
fftools/textformat/tf_flat.c | 3 +--
fftools/textformat/tf_ini.c | 4 +---
fftools/textformat/tf_json.c | 3 +--
fftools/textformat/tf_mermaid.c | 3 +--
fftools/textformat/tf_xml.c | 4 ++--
libavcodec/avdct.h | 3 +++
libavcodec/v210enc.h | 5 ++---
libavformat/async.c | 4 +++-
libavformat/bluray.c | 1 +
libavformat/cache.c | 4 +++-
libavformat/crypto.c | 4 ++++
libavformat/file.c | 3 +++
libavformat/ipfsgateway.c | 3 +++
libavformat/libsmbclient.c | 2 ++
libavformat/network.c | 2 ++
libavformat/shared.c | 3 +++
libavformat/subfile.c | 2 ++
libavutil/avutil.h | 24 ------------------------
libavutil/opt.h | 19 -------------------
libavutil/utils.c | 21 ---------------------
libavutil/version.h | 1 -
24 files changed, 45 insertions(+), 86 deletions(-)
diff --git a/fftools/textformat/avtextformat.c b/fftools/textformat/avtextformat.c
index 05459f6e30..104137226b 100644
--- a/fftools/textformat/avtextformat.c
+++ b/fftools/textformat/avtextformat.c
@@ -18,19 +18,21 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <inttypes.h>
#include <limits.h>
+#include <math.h>
#include <stdarg.h>
-#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include "libavutil/mem.h"
#include "libavutil/avassert.h"
+#include "libavutil/avutil.h"
#include "libavutil/base64.h"
#include "libavutil/bprint.h"
+#include "libavutil/common.h"
#include "libavutil/error.h"
#include "libavutil/hash.h"
-#include "libavutil/intreadwrite.h"
#include "libavutil/macros.h"
#include "libavutil/opt.h"
#include "avtextformat.h"
diff --git a/fftools/textformat/tf_compact.c b/fftools/textformat/tf_compact.c
index c6311b5dea..fc6bd5250b 100644
--- a/fftools/textformat/tf_compact.c
+++ b/fftools/textformat/tf_compact.c
@@ -18,13 +18,13 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <inttypes.h>
#include <limits.h>
#include <stdarg.h>
-#include <stdint.h>
-#include <stdio.h>
#include <string.h>
#include "avtextformat.h"
+#include "libavutil/avutil.h"
#include "libavutil/bprint.h"
#include "libavutil/error.h"
#include "libavutil/opt.h"
diff --git a/fftools/textformat/tf_default.c b/fftools/textformat/tf_default.c
index 019bda9d44..78a463dd49 100644
--- a/fftools/textformat/tf_default.c
+++ b/fftools/textformat/tf_default.c
@@ -18,13 +18,14 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <inttypes.h>
#include <limits.h>
#include <stdarg.h>
-#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include "avtextformat.h"
+#include "libavutil/avutil.h"
#include "libavutil/bprint.h"
#include "libavutil/opt.h"
#include "tf_internal.h"
diff --git a/fftools/textformat/tf_flat.c b/fftools/textformat/tf_flat.c
index d5517f109b..8e7e62c48a 100644
--- a/fftools/textformat/tf_flat.c
+++ b/fftools/textformat/tf_flat.c
@@ -18,10 +18,9 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <inttypes.h>
#include <limits.h>
#include <stdarg.h>
-#include <stdint.h>
-#include <stdio.h>
#include <string.h>
#include "avtextformat.h"
diff --git a/fftools/textformat/tf_ini.c b/fftools/textformat/tf_ini.c
index d3c69483e4..63fccc940f 100644
--- a/fftools/textformat/tf_ini.c
+++ b/fftools/textformat/tf_ini.c
@@ -18,11 +18,9 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <inttypes.h>
#include <limits.h>
#include <stdarg.h>
-#include <stdint.h>
-#include <stdio.h>
-#include <string.h>
#include "avtextformat.h"
diff --git a/fftools/textformat/tf_json.c b/fftools/textformat/tf_json.c
index 78ea5dc21f..7980a41fda 100644
--- a/fftools/textformat/tf_json.c
+++ b/fftools/textformat/tf_json.c
@@ -18,10 +18,9 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <inttypes.h>
#include <limits.h>
#include <stdarg.h>
-#include <stdint.h>
-#include <stdio.h>
#include <string.h>
#include "avtextformat.h"
diff --git a/fftools/textformat/tf_mermaid.c b/fftools/textformat/tf_mermaid.c
index fae53d9c40..0eea73bd79 100644
--- a/fftools/textformat/tf_mermaid.c
+++ b/fftools/textformat/tf_mermaid.c
@@ -18,10 +18,9 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <inttypes.h>
#include <limits.h>
#include <stdarg.h>
-#include <stdint.h>
-#include <stdio.h>
#include <string.h>
#include "avtextformat.h"
diff --git a/fftools/textformat/tf_xml.c b/fftools/textformat/tf_xml.c
index d4329110f9..bad2a86bce 100644
--- a/fftools/textformat/tf_xml.c
+++ b/fftools/textformat/tf_xml.c
@@ -18,8 +18,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include <stdint.h>
-#include <string.h>
+#include <inttypes.h>
+#include <stddef.h>
#include "avtextformat.h"
#include "libavutil/bprint.h"
diff --git a/libavcodec/avdct.h b/libavcodec/avdct.h
index 6411fab6f6..f110ba7249 100644
--- a/libavcodec/avdct.h
+++ b/libavcodec/avdct.h
@@ -19,6 +19,9 @@
#ifndef AVCODEC_AVDCT_H
#define AVCODEC_AVDCT_H
+#include <stddef.h>
+#include <stdint.h>
+
#include "libavutil/opt.h"
/**
diff --git a/libavcodec/v210enc.h b/libavcodec/v210enc.h
index b74fd33db5..61b0f89bd7 100644
--- a/libavcodec/v210enc.h
+++ b/libavcodec/v210enc.h
@@ -19,9 +19,8 @@
#ifndef AVCODEC_V210ENC_H
#define AVCODEC_V210ENC_H
-#include "libavutil/log.h"
-#include "libavutil/opt.h"
-#include "libavutil/pixfmt.h"
+#include <stddef.h>
+#include <stdint.h>
typedef struct V210EncContext {
void (*pack_line_8)(const uint8_t *y, const uint8_t *u,
diff --git a/libavformat/async.c b/libavformat/async.c
index e0329e23ec..5831b12bd5 100644
--- a/libavformat/async.c
+++ b/libavformat/async.c
@@ -27,6 +27,9 @@
* support work with concatdec, hls
*/
+#include <inttypes.h>
+#include <string.h>
+
#include "libavutil/avassert.h"
#include "libavutil/avstring.h"
#include "libavutil/error.h"
@@ -35,7 +38,6 @@
#include "libavutil/opt.h"
#include "libavutil/thread.h"
#include "url.h"
-#include <stdint.h>
#if HAVE_UNISTD_H
#include <unistd.h>
diff --git a/libavformat/bluray.c b/libavformat/bluray.c
index 1845551c34..ade5ae9479 100644
--- a/libavformat/bluray.c
+++ b/libavformat/bluray.c
@@ -23,6 +23,7 @@
#include <libbluray/bluray.h>
#include "libavutil/avstring.h"
+#include "libavutil/error.h"
#include "libavformat/url.h"
#include "libavutil/opt.h"
diff --git a/libavformat/cache.c b/libavformat/cache.c
index 0d682213d5..9574f85c39 100644
--- a/libavformat/cache.c
+++ b/libavformat/cache.c
@@ -27,8 +27,11 @@
* support filling with a background thread
*/
+#include <inttypes.h>
+
#include "libavutil/avassert.h"
#include "libavutil/avstring.h"
+#include "libavutil/error.h"
#include "libavutil/file_open.h"
#include "libavutil/mem.h"
#include "libavutil/opt.h"
@@ -42,7 +45,6 @@
#include <unistd.h>
#endif
#include <sys/stat.h>
-#include <stdlib.h>
#include "os_support.h"
#include "url.h"
diff --git a/libavformat/crypto.c b/libavformat/crypto.c
index bcfee6a3ee..4bc47f0128 100644
--- a/libavformat/crypto.c
+++ b/libavformat/crypto.c
@@ -19,8 +19,12 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <inttypes.h>
+#include <string.h>
+
#include "libavutil/aes.h"
#include "libavutil/avstring.h"
+#include "libavutil/error.h"
#include "libavutil/mem.h"
#include "libavutil/opt.h"
#include "url.h"
diff --git a/libavformat/file.c b/libavformat/file.c
index 1bac50ac7f..71d30a25c4 100644
--- a/libavformat/file.c
+++ b/libavformat/file.c
@@ -19,9 +19,12 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <string.h>
+
#include "config_components.h"
#include "libavutil/avstring.h"
+#include "libavutil/error.h"
#include "libavutil/file_open.h"
#include "libavutil/internal.h"
#include "libavutil/mem.h"
diff --git a/libavformat/ipfsgateway.c b/libavformat/ipfsgateway.c
index 4699b8c3d7..1ea1742801 100644
--- a/libavformat/ipfsgateway.c
+++ b/libavformat/ipfsgateway.c
@@ -19,7 +19,10 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <string.h>
+
#include "libavutil/avstring.h"
+#include "libavutil/error.h"
#include "libavutil/file_open.h"
#include "libavutil/getenv_utf8.h"
#include "libavutil/mem.h"
diff --git a/libavformat/libsmbclient.c b/libavformat/libsmbclient.c
index 28de2daa9b..e35708db30 100644
--- a/libavformat/libsmbclient.c
+++ b/libavformat/libsmbclient.c
@@ -19,7 +19,9 @@
*/
#include <libsmbclient.h>
+#include <string.h>
#include "libavutil/avstring.h"
+#include "libavutil/error.h"
#include "libavutil/mem.h"
#include "libavutil/opt.h"
#include "url.h"
diff --git a/libavformat/network.c b/libavformat/network.c
index 5bfc28d80d..2b7e665bc4 100644
--- a/libavformat/network.c
+++ b/libavformat/network.c
@@ -18,6 +18,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <string.h>
+
#include "config.h"
#include "config_components.h"
#include "libavutil/attributes.h"
diff --git a/libavformat/shared.c b/libavformat/shared.c
index a7dccb33df..7c8b17350c 100644
--- a/libavformat/shared.c
+++ b/libavformat/shared.c
@@ -25,6 +25,7 @@
#include "libavutil/avassert.h"
#include "libavutil/avstring.h"
#include "libavutil/crc.h"
+#include "libavutil/error.h"
#include "libavutil/hash.h"
#include "libavutil/file_open.h"
#include "libavutil/mem.h"
@@ -35,7 +36,9 @@
#include <errno.h>
#include <fcntl.h>
+#include <inttypes.h>
#include <stdatomic.h>
+#include <string.h>
#include <sys/file.h>
#include <sys/mman.h>
#include <sys/stat.h>
diff --git a/libavformat/subfile.c b/libavformat/subfile.c
index 89799feaec..a77e477db2 100644
--- a/libavformat/subfile.c
+++ b/libavformat/subfile.c
@@ -20,6 +20,8 @@
#include "libavutil/avassert.h"
#include "libavutil/avstring.h"
+#include "libavutil/common.h"
+#include "libavutil/error.h"
#include "libavutil/opt.h"
#include "url.h"
diff --git a/libavutil/avutil.h b/libavutil/avutil.h
index c8ae114ab6..003a63b7b1 100644
--- a/libavutil/avutil.h
+++ b/libavutil/avutil.h
@@ -313,30 +313,6 @@ static inline void *av_x_if_null(const void *p, const void *x)
return (void *)(intptr_t)(p ? p : x);
}
-#if FF_API_OPT_INT_LIST
-/**
- * Compute the length of an integer list.
- *
- * @param elsize size in bytes of each list element (only 1, 2, 4 or 8)
- * @param term list terminator (usually 0 or -1)
- * @param list pointer to the list
- * @return length of the list, in elements, not counting the terminator
- */
-attribute_deprecated
-unsigned av_int_list_length_for_size(unsigned elsize,
- const void *list, uint64_t term) av_pure;
-
-/**
- * Compute the length of an integer list.
- *
- * @param term list terminator (usually 0 or -1)
- * @param list pointer to the list
- * @return length of the list, in elements, not counting the terminator
- */
-#define av_int_list_length(list, term) \
- av_int_list_length_for_size(sizeof(*(list)), list, term)
-#endif
-
/**
* Return the fractional representation of the internal time base.
*/
diff --git a/libavutil/opt.h b/libavutil/opt.h
index ab24fae777..82420bba47 100644
--- a/libavutil/opt.h
+++ b/libavutil/opt.h
@@ -28,7 +28,6 @@
*/
#include "rational.h"
-#include "avutil.h"
#include "channel_layout.h"
#include "dict.h"
#include "log.h"
@@ -886,24 +885,6 @@ int av_opt_set_chlayout(void *obj, const char *name, const AVChannelLayout *layo
*/
int av_opt_set_dict_val(void *obj, const char *name, const AVDictionary *val, int search_flags);
-#if FF_API_OPT_INT_LIST
-/**
- * Set a binary option to an integer list.
- *
- * @param obj AVClass object to set options on
- * @param name name of the binary option
- * @param val pointer to an integer list (must have the correct type with
- * regard to the contents of the list)
- * @param term list terminator (usually 0 or -1)
- * @param flags search flags
- */
-#define av_opt_set_int_list(obj, name, val, term, flags) \
- (av_int_list_length(val, term) > INT_MAX / sizeof(*(val)) ? \
- AVERROR(EINVAL) : \
- av_opt_set_bin(obj, name, (const uint8_t *)(val), \
- av_int_list_length(val, term) * sizeof(*(val)), flags))
-#endif
-
/**
* Add, replace, or remove elements for an array option. Which of these
* operations is performed depends on the values of val and search_flags.
diff --git a/libavutil/utils.c b/libavutil/utils.c
index fc431fdd60..d77388752b 100644
--- a/libavutil/utils.c
+++ b/libavutil/utils.c
@@ -51,27 +51,6 @@ char av_get_picture_type_char(enum AVPictureType pict_type)
}
}
-#if FF_API_OPT_INT_LIST
-unsigned av_int_list_length_for_size(unsigned elsize,
- const void *list, uint64_t term)
-{
- unsigned i;
-
- if (!list)
- return 0;
-#define LIST_LENGTH(type) \
- { type t = term, *l = (type *)list; for (i = 0; l[i] != t; i++); }
- switch (elsize) {
- case 1: LIST_LENGTH(uint8_t); break;
- case 2: LIST_LENGTH(uint16_t); break;
- case 4: LIST_LENGTH(uint32_t); break;
- case 8: LIST_LENGTH(uint64_t); break;
- default: av_assert0(!"valid element size");
- }
- return i;
-}
-#endif
-
char *av_fourcc_make_string(char *buf, uint32_t fourcc)
{
int i;
diff --git a/libavutil/version.h b/libavutil/version.h
index 331fbc32b3..becca0e0f1 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -105,7 +105,6 @@
* @{
*/
-#define FF_API_OPT_INT_LIST (LIBAVUTIL_VERSION_MAJOR < 61)
#define FF_API_OPT_PTR (LIBAVUTIL_VERSION_MAJOR < 61)
#define FF_API_CPU_FLAG_FORCE (LIBAVUTIL_VERSION_MAJOR < 61)
#define FF_API_DOVI_L11_INVALID_PROPS (LIBAVUTIL_VERSION_MAJOR < 61)
--
2.52.0
From be6bae414f5d09528f387fea9f109cc0826e422b Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
Date: Mon, 9 Mar 2026 07:08:47 +0100
Subject: [PATCH 24/33] avutil/opt: Remove FF_API_OPT_PTR
Deprecated on 2024-10-16.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
---
libavutil/opt.c | 13 -------------
libavutil/opt.h | 15 ---------------
libavutil/version.h | 1 -
3 files changed, 29 deletions(-)
diff --git a/libavutil/opt.c b/libavutil/opt.c
index fca8772c18..dd7d7a597c 100644
--- a/libavutil/opt.c
+++ b/libavutil/opt.c
@@ -39,7 +39,6 @@
#include "opt.h"
#include "samplefmt.h"
#include "bprint.h"
-#include "version.h"
#include <float.h>
@@ -2048,18 +2047,6 @@ const AVClass *av_opt_child_class_iterate(const AVClass *parent, void **iter)
return NULL;
}
-#if FF_API_OPT_PTR
-void *av_opt_ptr(const AVClass *class, void *obj, const char *name)
-{
- const AVOption *opt= av_opt_find2(&class, name, NULL, 0, AV_OPT_SEARCH_FAKE_OBJ, NULL);
-
- // no direct access to array-type options
- if (!opt || (opt->type & AV_OPT_TYPE_FLAG_ARRAY))
- return NULL;
- return (uint8_t*)obj + opt->offset;
-}
-#endif
-
static int opt_copy_elem(void *logctx, enum AVOptionType type,
void *dst, const void *src)
{
diff --git a/libavutil/opt.h b/libavutil/opt.h
index 82420bba47..2a50f52fc3 100644
--- a/libavutil/opt.h
+++ b/libavutil/opt.h
@@ -1052,21 +1052,6 @@ int av_opt_eval_q (void *obj, const AVOption *o, const char *val, AVRational
* @}
*/
-#if FF_API_OPT_PTR
-/**
- * Gets a pointer to the requested field in a struct.
- * This function allows accessing a struct even when its fields are moved or
- * renamed since the application making the access has been compiled,
- *
- * @returns a pointer to the field, it can be cast to the correct type and read
- * or written to.
- *
- * @deprecated direct access to AVOption-exported fields is not supported
- */
-attribute_deprecated
-void *av_opt_ptr(const AVClass *avclass, void *obj, const char *name);
-#endif
-
/**
* Check if given option is set to its default value.
*
diff --git a/libavutil/version.h b/libavutil/version.h
index becca0e0f1..b60e4310ec 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -105,7 +105,6 @@
* @{
*/
-#define FF_API_OPT_PTR (LIBAVUTIL_VERSION_MAJOR < 61)
#define FF_API_CPU_FLAG_FORCE (LIBAVUTIL_VERSION_MAJOR < 61)
#define FF_API_DOVI_L11_INVALID_PROPS (LIBAVUTIL_VERSION_MAJOR < 61)
#define FF_API_ASSERT_FPU (LIBAVUTIL_VERSION_MAJOR < 61)
--
2.52.0
From 7656321943c5ffbc897d4a599d584bd19a0ab0b8 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
Date: Mon, 9 Mar 2026 07:18:07 +0100
Subject: [PATCH 25/33] avutil/xga_font_data: Stop exporting font data directly
Commit c6c80631868dbe96d9fe0b2a61181d970381191a added getters for them.
Also remove av_export_avutil and the BUILDING_foo macro.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
---
ffbuild/library.mak | 2 --
libavutil/internal.h | 6 ------
libavutil/xga_font_data.c | 14 ++++----------
libavutil/xga_font_data.h | 7 -------
4 files changed, 4 insertions(+), 25 deletions(-)
diff --git a/ffbuild/library.mak b/ffbuild/library.mak
index 91daa9c25f..5ab7eb4615 100644
--- a/ffbuild/library.mak
+++ b/ffbuild/library.mak
@@ -53,8 +53,6 @@ define RULES
$(TOOLS): THISLIB = $(FULLNAME:%=$(LD_LIB))
$(TESTPROGS): THISLIB = $(SUBDIR)$(LIBNAME)
-$(LIBOBJS): CPPFLAGS += -DBUILDING_$(NAME)
-
$(NAME)LINK_EXE_ARGS = $(LDFLAGS) $(LDEXEFLAGS)
$(NAME)LINK_SO_ARGS = $(SHFLAGS) $(LDFLAGS) $(LDSOFLAGS)
$(NAME)LINK_EXTRA = $(FFEXTRALIBS)
diff --git a/libavutil/internal.h b/libavutil/internal.h
index 2a85170795..2040937bfb 100644
--- a/libavutil/internal.h
+++ b/libavutil/internal.h
@@ -51,12 +51,6 @@
#endif
#endif
-#if defined(_WIN32) && CONFIG_SHARED && !defined(BUILDING_avutil)
-# define av_export_avutil __declspec(dllimport)
-#else
-# define av_export_avutil
-#endif
-
#if HAVE_PRAGMA_DEPRECATED
# if defined(__ICL) || defined (__INTEL_COMPILER)
# define FF_DISABLE_DEPRECATION_WARNINGS __pragma(warning(push)) __pragma(warning(disable:1478))
diff --git a/libavutil/xga_font_data.c b/libavutil/xga_font_data.c
index e4b21760f8..dbd1bbb48a 100644
--- a/libavutil/xga_font_data.c
+++ b/libavutil/xga_font_data.c
@@ -26,10 +26,7 @@
#include <stdint.h>
#include "xga_font_data.h"
-#if LIBAVUTIL_VERSION_MAJOR > 60
-static
-#endif
-const uint8_t avpriv_cga_font[2048] = {
+static const uint8_t cga_font[2048] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x81, 0xa5, 0x81, 0xbd, 0x99, 0x81, 0x7e,
0x7e, 0xff, 0xdb, 0xff, 0xc3, 0xe7, 0xff, 0x7e, 0x6c, 0xfe, 0xfe, 0xfe, 0x7c, 0x38, 0x10, 0x00,
0x10, 0x38, 0x7c, 0xfe, 0x7c, 0x38, 0x10, 0x00, 0x38, 0x7c, 0x38, 0xfe, 0xfe, 0x7c, 0x38, 0x7c,
@@ -162,13 +159,10 @@ const uint8_t avpriv_cga_font[2048] = {
const uint8_t *avpriv_cga_font_get(void)
{
- return avpriv_cga_font;
+ return cga_font;
}
-#if LIBAVUTIL_VERSION_MAJOR > 60
-static
-#endif
-const uint8_t avpriv_vga16_font[4096] = {
+static const uint8_t vga16_font[4096] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x7e, 0x81, 0xa5, 0x81, 0x81, 0xbd, 0x99, 0x81, 0x81, 0x7e, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x7e, 0xff, 0xdb, 0xff, 0xff, 0xc3, 0xe7, 0xff, 0xff, 0x7e, 0x00, 0x00, 0x00, 0x00,
@@ -429,5 +423,5 @@ const uint8_t avpriv_vga16_font[4096] = {
const uint8_t *avpriv_vga16_font_get(void)
{
- return avpriv_vga16_font;
+ return vga16_font;
}
diff --git a/libavutil/xga_font_data.h b/libavutil/xga_font_data.h
index 90d3cec4ce..0ca4d8616d 100644
--- a/libavutil/xga_font_data.h
+++ b/libavutil/xga_font_data.h
@@ -27,13 +27,6 @@
#define AVUTIL_XGA_FONT_DATA_H
#include <stdint.h>
-#include "internal.h"
-#include "version.h"
-
-#if LIBAVUTIL_VERSION_MAJOR < 61
-extern av_export_avutil const uint8_t avpriv_cga_font[2048];
-extern av_export_avutil const uint8_t avpriv_vga16_font[4096];
-#endif
const uint8_t *avpriv_cga_font_get(void);
const uint8_t *avpriv_vga16_font_get(void);
--
2.52.0
From efcc2af5da8fddf106c2d51b60ab397572c07d5d Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
Date: Mon, 9 Mar 2026 12:36:05 +0100
Subject: [PATCH 26/33] avutil/x86/emms: Unavpriv avpriv_emms_asm()
This fallback function is used if external MMX is available,
while inline MMX and intrinsics for emitting emms are unavailable.
It is implemented as an avpriv function, which has several
drawbacks for shared builds:
1. The function is so small (3 bytes; 16 with padding)
that the overhead of exporting and importing it dwarfs
the gains from code deduplication.
2. A call to an external library has more overhead than
a library-internal one.
3. It may cause linking failures when a libavutil not exporting
avpriv_emms_asm() is paired with a library needing it
(if inline assembly and intrinsics were unavailable when building
the dependent library). I am not aware of this ever happening.
4. We would be forced to keep avpriv_emms_asm() around for ABI stability
even after it is no longer needed.
This commit therefore uses the STLIBOBJS, SHLIBOBJS approach
to duplicating it into each library on its own if needed.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
---
libavcodec/x86/Makefile | 4 ++++
libavcodec/x86/emms.asm | 19 +++++++++++++++++++
libavfilter/x86/Makefile | 4 ++++
libavfilter/x86/emms.asm | 19 +++++++++++++++++++
libavutil/emms.h | 5 ++---
libavutil/x86/Makefile | 3 ++-
libavutil/x86/emms.asm | 4 ++--
libswscale/x86/Makefile | 4 ++++
libswscale/x86/emms.asm | 19 +++++++++++++++++++
9 files changed, 75 insertions(+), 6 deletions(-)
create mode 100644 libavcodec/x86/emms.asm
create mode 100644 libavfilter/x86/emms.asm
create mode 100644 libswscale/x86/emms.asm
diff --git a/libavcodec/x86/Makefile b/libavcodec/x86/Makefile
index e87cb750f4..890ac15f2a 100644
--- a/libavcodec/x86/Makefile
+++ b/libavcodec/x86/Makefile
@@ -1,5 +1,9 @@
OBJS += x86/constants.o \
+EMMS_OBJS_$(HAVE_MMX_INLINE)_$(HAVE_MMX_EXTERNAL)_$(HAVE_MM_EMPTY) = x86/emms.o
+# Add internal copy of ff_emms() to lavc for shared builds (if needed).
+SHLIBOBJS += $(EMMS_OBJS__yes_)
+
# subsystems
X86ASM-OBJS-$(CONFIG_AC3DSP) += x86/ac3dsp_init.o
X86ASM-OBJS-$(CONFIG_AUDIODSP) += x86/audiodsp_init.o
diff --git a/libavcodec/x86/emms.asm b/libavcodec/x86/emms.asm
new file mode 100644
index 0000000000..513a0e9fd8
--- /dev/null
+++ b/libavcodec/x86/emms.asm
@@ -0,0 +1,19 @@
+;*****************************************************************************
+;* 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 "libavutil/x86/emms.asm"
diff --git a/libavfilter/x86/Makefile b/libavfilter/x86/Makefile
index ade0efc9ae..cfbed4317c 100644
--- a/libavfilter/x86/Makefile
+++ b/libavfilter/x86/Makefile
@@ -1,6 +1,10 @@
OBJS-$(CONFIG_NOISE_FILTER) += x86/vf_noise.o
OBJS-$(CONFIG_SPP_FILTER) += x86/vf_spp.o
+EMMS_OBJS_$(HAVE_MMX_INLINE)_$(HAVE_MMX_EXTERNAL)_$(HAVE_MM_EMPTY) = x86/emms.o
+# Add internal copy of ff_emms() to libavfilter for shared builds (if needed).
+SHLIBOBJS-$(CONFIG_FSPP_FILTER) += $(EMMS_OBJS__yes_)
+
X86ASM-OBJS-$(CONFIG_SCENE_SAD) += x86/scene_sad.o x86/scene_sad_init.o
X86ASM-OBJS-$(CONFIG_AFIR_FILTER) += x86/af_afir.o x86/af_afir_init.o
diff --git a/libavfilter/x86/emms.asm b/libavfilter/x86/emms.asm
new file mode 100644
index 0000000000..513a0e9fd8
--- /dev/null
+++ b/libavfilter/x86/emms.asm
@@ -0,0 +1,19 @@
+;*****************************************************************************
+;* 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 "libavutil/x86/emms.asm"
diff --git a/libavutil/emms.h b/libavutil/emms.h
index 2b9a456223..bad0bdbd9c 100644
--- a/libavutil/emms.h
+++ b/libavutil/emms.h
@@ -28,8 +28,6 @@
#if ARCH_X86
-void avpriv_emms_asm(void);
-
#if HAVE_MMX_INLINE
#ifndef __MMX__
#include "libavutil/cpu.h"
@@ -80,7 +78,8 @@ static inline void ff_assert0_fpu(const char *file, int line_number)
# include <mmintrin.h>
# define emms_c _mm_empty
#elif HAVE_MMX_EXTERNAL
-# define emms_c avpriv_emms_asm
+void ff_emms_asm(void);
+# define emms_c ff_emms_asm
#endif /* HAVE_MMX_INLINE */
#endif /* ARCH_X86 */
diff --git a/libavutil/x86/Makefile b/libavutil/x86/Makefile
index 590758ce78..a305503c0f 100644
--- a/libavutil/x86/Makefile
+++ b/libavutil/x86/Makefile
@@ -1,10 +1,11 @@
OBJS += x86/cpu.o \
EMMS_OBJS_$(HAVE_MMX_INLINE)_$(HAVE_MMX_EXTERNAL)_$(HAVE_MM_EMPTY) = x86/emms.o
+# For static builds, libavutil provides ff_emms for all libraries (if needed).
+STLIBOBJS += $(EMMS_OBJS__yes_)
X86ASM-OBJS += x86/cpuid.o \
x86/crc.o \
- $(EMMS_OBJS__yes_) \
x86/fixed_dsp.o x86/fixed_dsp_init.o \
x86/float_dsp.o x86/float_dsp_init.o \
x86/imgutils.o x86/imgutils_init.o \
diff --git a/libavutil/x86/emms.asm b/libavutil/x86/emms.asm
index df84f2221b..485fba4557 100644
--- a/libavutil/x86/emms.asm
+++ b/libavutil/x86/emms.asm
@@ -23,8 +23,8 @@
SECTION .text
;-----------------------------------------------------------------------------
-; void avpriv_emms_asm(void)
+; void ff_emms_asm(void)
;-----------------------------------------------------------------------------
-cvisible emms_asm, 0, 0
+cglobal emms_asm, 0, 0
emms
RET
diff --git a/libswscale/x86/Makefile b/libswscale/x86/Makefile
index 2eeb2b2627..0f7a3dbf2d 100644
--- a/libswscale/x86/Makefile
+++ b/libswscale/x86/Makefile
@@ -6,6 +6,10 @@ OBJS-$(HAVE_MMXEXT_INLINE) += x86/hscale_fast_bilinear_simd.o \
OBJS-$(CONFIG_XMM_CLOBBER_TEST) += x86/w64xmmtest.o
+EMMS_OBJS_$(HAVE_MMX_INLINE)_$(HAVE_MMX_EXTERNAL)_$(HAVE_MM_EMPTY) = x86/emms.o
+# Add internal copy of ff_emms() to swscale for shared builds (if needed).
+SHLIBOBJS += $(EMMS_OBJS__yes_)
+
X86ASM-OBJS += x86/input.o \
x86/output.o \
x86/scale.o \
diff --git a/libswscale/x86/emms.asm b/libswscale/x86/emms.asm
new file mode 100644
index 0000000000..513a0e9fd8
--- /dev/null
+++ b/libswscale/x86/emms.asm
@@ -0,0 +1,19 @@
+;*****************************************************************************
+;* 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 "libavutil/x86/emms.asm"
--
2.52.0
From 0cf3a247f696715b9c1d2ef3536b26e1f8606316 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
Date: Mon, 9 Mar 2026 14:19:49 +0100
Subject: [PATCH 27/33] libs: Bump major version of all libraries
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
---
doc/APIchanges | 2 +-
libavcodec/version.h | 2 +-
libavcodec/version_major.h | 12 ++++++------
libavdevice/version.h | 2 +-
libavdevice/version_major.h | 2 +-
libavfilter/version.h | 2 +-
libavfilter/version_major.h | 2 +-
libavformat/version.h | 4 ++--
libavformat/version_major.h | 6 +++---
libavutil/version.h | 12 ++++++------
libswresample/version.h | 2 +-
libswresample/version_major.h | 2 +-
libswscale/version.h | 2 +-
libswscale/version_major.h | 2 +-
14 files changed, 27 insertions(+), 27 deletions(-)
diff --git a/doc/APIchanges b/doc/APIchanges
index 02252e372a..86a135a0f3 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -1,4 +1,4 @@
-The last version increases of all libraries were on 2025-03-28
+The last version increases of all libraries were on 2026-06-04
API changes, most recent first:
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 376388c5bb..8c3d476003 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -29,7 +29,7 @@
#include "version_major.h"
-#define LIBAVCODEC_VERSION_MINOR 37
+#define LIBAVCODEC_VERSION_MINOR 0
#define LIBAVCODEC_VERSION_MICRO 100
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
diff --git a/libavcodec/version_major.h b/libavcodec/version_major.h
index cab80004ed..2c6b9d1ee2 100644
--- a/libavcodec/version_major.h
+++ b/libavcodec/version_major.h
@@ -25,7 +25,7 @@
* Libavcodec version macros.
*/
-#define LIBAVCODEC_VERSION_MAJOR 62
+#define LIBAVCODEC_VERSION_MAJOR 63
/**
* FF_API_* defines may be placed below to indicate public API that will be
@@ -37,13 +37,13 @@
* at once through the bump. This improves the git bisect-ability of the change.
*/
-#define FF_API_INIT_PACKET (LIBAVCODEC_VERSION_MAJOR < 63)
+#define FF_API_INIT_PACKET (LIBAVCODEC_VERSION_MAJOR < 64)
-#define FF_API_INTRA_DC_PRECISION (LIBAVCODEC_VERSION_MAJOR < 63)
-#define FF_API_MJPEG_EXTERN_HUFF (LIBAVCODEC_VERSION_MAJOR < 63)
+#define FF_API_INTRA_DC_PRECISION (LIBAVCODEC_VERSION_MAJOR < 64)
+#define FF_API_MJPEG_EXTERN_HUFF (LIBAVCODEC_VERSION_MAJOR < 64)
// reminder to remove Sonic Lossy/Lossless encoders on next major bump
-#define FF_CODEC_SONIC_ENC (LIBAVCODEC_VERSION_MAJOR < 63)
+#define FF_CODEC_SONIC_ENC (LIBAVCODEC_VERSION_MAJOR < 64)
// reminder to remove Sonic decoder on next-next major bump
-#define FF_CODEC_SONIC_DEC (LIBAVCODEC_VERSION_MAJOR < 63)
+#define FF_CODEC_SONIC_DEC (LIBAVCODEC_VERSION_MAJOR < 64)
#endif /* AVCODEC_VERSION_MAJOR_H */
diff --git a/libavdevice/version.h b/libavdevice/version.h
index 0e4ce64598..25befdead1 100644
--- a/libavdevice/version.h
+++ b/libavdevice/version.h
@@ -29,7 +29,7 @@
#include "version_major.h"
-#define LIBAVDEVICE_VERSION_MINOR 4
+#define LIBAVDEVICE_VERSION_MINOR 0
#define LIBAVDEVICE_VERSION_MICRO 100
#define LIBAVDEVICE_VERSION_INT AV_VERSION_INT(LIBAVDEVICE_VERSION_MAJOR, \
diff --git a/libavdevice/version_major.h b/libavdevice/version_major.h
index 2df1f3a2d4..f7b8652e55 100644
--- a/libavdevice/version_major.h
+++ b/libavdevice/version_major.h
@@ -25,7 +25,7 @@
* Libavdevice version macros
*/
-#define LIBAVDEVICE_VERSION_MAJOR 62
+#define LIBAVDEVICE_VERSION_MAJOR 63
/**
* FF_API_* defines may be placed below to indicate public API that will be
diff --git a/libavfilter/version.h b/libavfilter/version.h
index 12fc6c853d..d5a6bc143a 100644
--- a/libavfilter/version.h
+++ b/libavfilter/version.h
@@ -31,7 +31,7 @@
#include "version_major.h"
-#define LIBAVFILTER_VERSION_MINOR 17
+#define LIBAVFILTER_VERSION_MINOR 0
#define LIBAVFILTER_VERSION_MICRO 100
diff --git a/libavfilter/version_major.h b/libavfilter/version_major.h
index 4db5978d3b..a5d93410f3 100644
--- a/libavfilter/version_major.h
+++ b/libavfilter/version_major.h
@@ -27,7 +27,7 @@
* Libavfilter version macros
*/
-#define LIBAVFILTER_VERSION_MAJOR 11
+#define LIBAVFILTER_VERSION_MAJOR 12
/**
* FF_API_* defines may be placed below to indicate public API that will be
diff --git a/libavformat/version.h b/libavformat/version.h
index bbb2fc7d87..752aac16f7 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -31,8 +31,8 @@
#include "version_major.h"
-#define LIBAVFORMAT_VERSION_MINOR 19
-#define LIBAVFORMAT_VERSION_MICRO 101
+#define LIBAVFORMAT_VERSION_MINOR 0
+#define LIBAVFORMAT_VERSION_MICRO 100
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
LIBAVFORMAT_VERSION_MINOR, \
diff --git a/libavformat/version_major.h b/libavformat/version_major.h
index d2bf618fcd..1e43129016 100644
--- a/libavformat/version_major.h
+++ b/libavformat/version_major.h
@@ -29,7 +29,7 @@
// Major bumping may affect Ticket5467, 5421, 5451(compatibility with Chromium)
// Also please add any ticket numbers that you believe might be affected here
-#define LIBAVFORMAT_VERSION_MAJOR 62
+#define LIBAVFORMAT_VERSION_MAJOR 63
/**
* FF_API_* defines may be placed below to indicate public API that will be
@@ -41,9 +41,9 @@
* at once through the bump. This improves the git bisect-ability of the change.
*
*/
-#define FF_API_COMPUTE_PKT_FIELDS2 (LIBAVFORMAT_VERSION_MAJOR < 63)
+#define FF_API_COMPUTE_PKT_FIELDS2 (LIBAVFORMAT_VERSION_MAJOR < 64)
-#define FF_API_FDEBUG_TS (LIBAVFORMAT_VERSION_MAJOR < 63)
+#define FF_API_FDEBUG_TS (LIBAVFORMAT_VERSION_MAJOR < 64)
#define FF_API_LCEVC_STRUCT (LIBAVFORMAT_VERSION_MAJOR < 64)
diff --git a/libavutil/version.h b/libavutil/version.h
index b60e4310ec..fa58c32c37 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -78,9 +78,9 @@
* @{
*/
-#define LIBAVUTIL_VERSION_MAJOR 60
-#define LIBAVUTIL_VERSION_MINOR 33
-#define LIBAVUTIL_VERSION_MICRO 101
+#define LIBAVUTIL_VERSION_MAJOR 61
+#define LIBAVUTIL_VERSION_MINOR 0
+#define LIBAVUTIL_VERSION_MICRO 100
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
LIBAVUTIL_VERSION_MINOR, \
@@ -105,9 +105,9 @@
* @{
*/
-#define FF_API_CPU_FLAG_FORCE (LIBAVUTIL_VERSION_MAJOR < 61)
-#define FF_API_DOVI_L11_INVALID_PROPS (LIBAVUTIL_VERSION_MAJOR < 61)
-#define FF_API_ASSERT_FPU (LIBAVUTIL_VERSION_MAJOR < 61)
+#define FF_API_CPU_FLAG_FORCE (LIBAVUTIL_VERSION_MAJOR < 62)
+#define FF_API_DOVI_L11_INVALID_PROPS (LIBAVUTIL_VERSION_MAJOR < 62)
+#define FF_API_ASSERT_FPU (LIBAVUTIL_VERSION_MAJOR < 62)
#define FF_API_VULKAN_SYNC_QUEUES (LIBAVUTIL_VERSION_MAJOR < 62)
/**
diff --git a/libswresample/version.h b/libswresample/version.h
index 9a514e6d6f..703023094e 100644
--- a/libswresample/version.h
+++ b/libswresample/version.h
@@ -30,7 +30,7 @@
#include "version_major.h"
-#define LIBSWRESAMPLE_VERSION_MINOR 4
+#define LIBSWRESAMPLE_VERSION_MINOR 0
#define LIBSWRESAMPLE_VERSION_MICRO 100
#define LIBSWRESAMPLE_VERSION_INT AV_VERSION_INT(LIBSWRESAMPLE_VERSION_MAJOR, \
diff --git a/libswresample/version_major.h b/libswresample/version_major.h
index 4e0bc0ab19..0dc51de324 100644
--- a/libswresample/version_major.h
+++ b/libswresample/version_major.h
@@ -26,6 +26,6 @@
* Libswresample version macros
*/
-#define LIBSWRESAMPLE_VERSION_MAJOR 6
+#define LIBSWRESAMPLE_VERSION_MAJOR 7
#endif /* SWRESAMPLE_VERSION_MAJOR_H */
diff --git a/libswscale/version.h b/libswscale/version.h
index c0610fec1e..148efd83eb 100644
--- a/libswscale/version.h
+++ b/libswscale/version.h
@@ -28,7 +28,7 @@
#include "version_major.h"
-#define LIBSWSCALE_VERSION_MINOR 8
+#define LIBSWSCALE_VERSION_MINOR 0
#define LIBSWSCALE_VERSION_MICRO 100
#define LIBSWSCALE_VERSION_INT AV_VERSION_INT(LIBSWSCALE_VERSION_MAJOR, \
diff --git a/libswscale/version_major.h b/libswscale/version_major.h
index 0dc507921e..5666f17751 100644
--- a/libswscale/version_major.h
+++ b/libswscale/version_major.h
@@ -24,7 +24,7 @@
* swscale version macros
*/
-#define LIBSWSCALE_VERSION_MAJOR 9
+#define LIBSWSCALE_VERSION_MAJOR 10
/**
* FF_API_* defines may be placed below to indicate public API that will be
--
2.52.0
From 33d49892562367efbee7f9daa3435c462c47dab7 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
Date: Mon, 9 Mar 2026 12:54:47 +0100
Subject: [PATCH 28/33] fftools/ffmpeg_opt: Remove deprecated no-op -qphist
option
Deprecated and disabled in commit 2f24290c8edd14262ee8a674a64b1223e1cbbf41
on 2023-04-13.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
---
fftools/ffmpeg.h | 1 -
fftools/ffmpeg_opt.c | 13 -------------
2 files changed, 14 deletions(-)
diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h
index 8c85f1ef7f..55aa5462f5 100644
--- a/fftools/ffmpeg.h
+++ b/fftools/ffmpeg.h
@@ -52,7 +52,6 @@
#include "libswresample/swresample.h"
// deprecated features
-#define FFMPEG_OPT_QPHIST 1
#define FFMPEG_OPT_ADRIFT_THRESHOLD 1
#define FFMPEG_OPT_ENC_TIME_BASE_NUM 1
#define FFMPEG_OPT_TOP 1
diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index 28e6cee741..06e3f089e6 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -1597,14 +1597,6 @@ int opt_timelimit(void *optctx, const char *opt, const char *arg)
return 0;
}
-#if FFMPEG_OPT_QPHIST
-static int opt_qphist(void *optctx, const char *opt, const char *arg)
-{
- av_log(NULL, AV_LOG_WARNING, "Option -%s is deprecated and has no effect\n", opt);
- return 0;
-}
-#endif
-
#if FFMPEG_OPT_ADRIFT_THRESHOLD
static int opt_adrift_threshold(void *optctx, const char *opt, const char *arg)
{
@@ -2192,11 +2184,6 @@ const OptionDef options[] = {
{ .off = OFFSET(top_field_first) },
"deprecated, use the setfield video filter", "" },
#endif
-#if FFMPEG_OPT_QPHIST
- { "qphist", OPT_TYPE_FUNC, OPT_VIDEO | OPT_EXPERT,
- { .func_arg = opt_qphist },
- "deprecated, does nothing" },
-#endif
#if FFMPEG_OPT_VSYNC
{ "vsync", OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_EXPERT,
{ .func_arg = opt_vsync },
--
2.52.0
From f7b957b465012626dd0fc5bb0ae32f94924f5957 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
Date: Mon, 9 Mar 2026 13:18:01 +0100
Subject: [PATCH 29/33] fftools/ffmpeg_opt: Remove disabled and deprecated
adrift_threshold
Deprecated in commit 5a04aae82193d75b8f8814dc7e35f4cc84b1beba
on 2023-05-02.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
---
fftools/ffmpeg.h | 1 -
fftools/ffmpeg_opt.c | 13 -------------
2 files changed, 14 deletions(-)
diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h
index 55aa5462f5..9ed48d34cd 100644
--- a/fftools/ffmpeg.h
+++ b/fftools/ffmpeg.h
@@ -52,7 +52,6 @@
#include "libswresample/swresample.h"
// deprecated features
-#define FFMPEG_OPT_ADRIFT_THRESHOLD 1
#define FFMPEG_OPT_ENC_TIME_BASE_NUM 1
#define FFMPEG_OPT_TOP 1
#define FFMPEG_OPT_FORCE_KF_SOURCE_NO_DROP 1
diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index 06e3f089e6..8a892aec68 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -1597,14 +1597,6 @@ int opt_timelimit(void *optctx, const char *opt, const char *arg)
return 0;
}
-#if FFMPEG_OPT_ADRIFT_THRESHOLD
-static int opt_adrift_threshold(void *optctx, const char *opt, const char *arg)
-{
- av_log(NULL, AV_LOG_WARNING, "Option -%s is deprecated and has no effect\n", opt);
- return 0;
-}
-#endif
-
static const char *const alt_channel_layout[] = { "ch_layout", NULL};
static const char *const alt_codec[] = { "c", "acodec", "vcodec", "scodec", "dcodec", NULL };
static const char *const alt_filter[] = { "af", "vf", NULL };
@@ -2174,11 +2166,6 @@ const OptionDef options[] = {
"set hardware device used when filtering", "device" },
// deprecated options
-#if FFMPEG_OPT_ADRIFT_THRESHOLD
- { "adrift_threshold", OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_EXPERT,
- { .func_arg = opt_adrift_threshold },
- "deprecated, does nothing", "threshold" },
-#endif
#if FFMPEG_OPT_TOP
{ "top", OPT_TYPE_INT, OPT_VIDEO | OPT_EXPERT | OPT_PERSTREAM | OPT_INPUT | OPT_OUTPUT,
{ .off = OFFSET(top_field_first) },
--
2.52.0
From 3d7cd7bb3c3b2ad7774e69c453759e5b0ae3f20d Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
Date: Mon, 9 Mar 2026 13:21:29 +0100
Subject: [PATCH 30/33] fftools/ffmpeg_mux_init: Remove deprecated
FFMPEG_OPT_ENC_TIME_BASE_NUM
Deprecated in commit dff3a283cd8c71802d43fbbbfcf57fb479784a24
on 2023-07-23.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
---
fftools/ffmpeg.h | 1 -
fftools/ffmpeg_mux_init.c | 11 +----------
2 files changed, 1 insertion(+), 11 deletions(-)
diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h
index 9ed48d34cd..7adeddf071 100644
--- a/fftools/ffmpeg.h
+++ b/fftools/ffmpeg.h
@@ -52,7 +52,6 @@
#include "libswresample/swresample.h"
// deprecated features
-#define FFMPEG_OPT_ENC_TIME_BASE_NUM 1
#define FFMPEG_OPT_TOP 1
#define FFMPEG_OPT_FORCE_KF_SOURCE_NO_DROP 1
#define FFMPEG_OPT_VSYNC_DROP 1
diff --git a/fftools/ffmpeg_mux_init.c b/fftools/ffmpeg_mux_init.c
index ef71a7bb54..ac706bf2d4 100644
--- a/fftools/ffmpeg_mux_init.c
+++ b/fftools/ffmpeg_mux_init.c
@@ -1401,20 +1401,11 @@ static int ost_add(Muxer *mux, const OptionsContext *o, enum AVMediaType type,
q = (AVRational){ ENC_TIME_BASE_FILTER, 0 };
} else {
ret = av_parse_ratio(&q, enc_time_base, INT_MAX, 0, NULL);
- if (ret < 0 || q.den <= 0
-#if !FFMPEG_OPT_ENC_TIME_BASE_NUM
- || q.num < 0
-#endif
- ) {
+ if (ret < 0 || q.den <= 0 || q.num < 0) {
av_log(ost, AV_LOG_FATAL, "Invalid time base: %s\n", enc_time_base);
ret = ret < 0 ? ret : AVERROR(EINVAL);
goto fail;
}
-#if FFMPEG_OPT_ENC_TIME_BASE_NUM
- if (q.num < 0)
- av_log(ost, AV_LOG_WARNING, "-enc_time_base -1 is deprecated,"
- " use -enc_time_base demux\n");
-#endif
}
enc_tb = q;
--
2.52.0
From 4594b3c5d1023f520777f10a72f7247ee6955571 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
Date: Mon, 9 Mar 2026 13:32:19 +0100
Subject: [PATCH 31/33] fftools/ffmpeg_mux_init: Remove deprecated
source_no_drop
Deprecated in commit d2c416fdf1ecc9c354642d7410944a506c4985a6
on 2023-10-10.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
---
fftools/ffmpeg.h | 4 ----
fftools/ffmpeg_mux_init.c | 6 ------
2 files changed, 10 deletions(-)
diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h
index 7adeddf071..c29e2dc545 100644
--- a/fftools/ffmpeg.h
+++ b/fftools/ffmpeg.h
@@ -53,7 +53,6 @@
// deprecated features
#define FFMPEG_OPT_TOP 1
-#define FFMPEG_OPT_FORCE_KF_SOURCE_NO_DROP 1
#define FFMPEG_OPT_VSYNC_DROP 1
#define FFMPEG_OPT_VSYNC 1
#define FFMPEG_OPT_FILTER_SCRIPT 1
@@ -603,9 +602,6 @@ typedef struct EncStats {
enum {
KF_FORCE_SOURCE = 1,
-#if FFMPEG_OPT_FORCE_KF_SOURCE_NO_DROP
- KF_FORCE_SOURCE_NO_DROP = 2,
-#endif
// force keyframe if lavfi.scd.time metadata is set
KF_FORCE_SCD_METADATA = 3,
};
diff --git a/fftools/ffmpeg_mux_init.c b/fftools/ffmpeg_mux_init.c
index ac706bf2d4..a857b16118 100644
--- a/fftools/ffmpeg_mux_init.c
+++ b/fftools/ffmpeg_mux_init.c
@@ -3284,12 +3284,6 @@ static int process_forced_keyframes(Muxer *mux, const OptionsContext *o)
// parse it only for static kf timings
} else if (!strcmp(forced_keyframes, "source")) {
ost->kf.type = KF_FORCE_SOURCE;
-#if FFMPEG_OPT_FORCE_KF_SOURCE_NO_DROP
- } else if (!strcmp(forced_keyframes, "source_no_drop")) {
- av_log(ost, AV_LOG_WARNING, "The 'source_no_drop' value for "
- "-force_key_frames is deprecated, use just 'source'\n");
- ost->kf.type = KF_FORCE_SOURCE;
-#endif
} else if (!strcmp(forced_keyframes, "scd_metadata")) {
ost->kf.type = KF_FORCE_SCD_METADATA;
} else {
--
2.52.0
From bf4a946ca90e74c9cfe5ce7ac5b089c9ac4364f7 Mon Sep 17 00:00:00 2001
From: Michael Niedermayer <michael(a)niedermayer.cc>
Date: Sun, 21 Jun 2026 12:39:23 +0200
Subject: [PATCH 32/33] avcodec/avformat: Unavpriv avpriv_packet_list_*()
The avpriv_packet_list_put/get/free() functions and the PacketList type
were implemented in libavcodec and exported via the avpriv_ mechanism
solely so that libavformat (and decklink in libavdevice) could use them;
libavcodec itself has no users of them. Exporting them across the library
boundary has the usual drawbacks for shared builds (export/import overhead
and having to keep them around for ABI stability even once unneeded).
Move the implementation and the PacketList/PacketListEntry types to
libavformat and rename the functions to ff_packet_list_*(). libavformat is
the primary user and compiles the new packet_list.c directly; decklink,
the only libavdevice user, gets a private copy for shared builds via the
SHLIBOBJS scheme already used for reverse.o and ccfifo.o (static builds
resolve the symbols from libavformat).
AVPACKET_IS_EMPTY() and ff_side_data_set_prft() remain in
libavcodec/packet_internal.h as they are libavcodec-internal.
---
libavcodec/packet.c | 76 ---------------------
libavcodec/packet_internal.h | 45 -------------
libavdevice/Makefile | 4 +-
libavdevice/decklink_common.cpp | 6 +-
libavdevice/decklink_common.h | 2 +-
libavdevice/decklink_dec.cpp | 2 +-
libavdevice/dshow_capture.h | 2 +-
libavdevice/packet_list.c | 22 ++++++
libavdevice/vfwcap.c | 2 +-
libavformat/Makefile | 1 +
libavformat/aiffenc.c | 6 +-
libavformat/avformat.c | 10 +--
libavformat/demux.c | 20 +++---
libavformat/demux_utils.c | 4 +-
libavformat/flacenc.c | 8 +--
libavformat/internal.h | 2 +-
libavformat/matroskadec.c | 12 ++--
libavformat/movenc.c | 4 +-
libavformat/movenc.h | 2 +-
libavformat/movenc_ttml.c | 14 ++--
libavformat/mp3enc.c | 8 +--
libavformat/mux.c | 4 +-
libavformat/mxfenc.c | 4 +-
libavformat/packet_internal.h | 69 +++++++++++++++++++
libavformat/packet_list.c | 114 ++++++++++++++++++++++++++++++++
libavformat/ttaenc.c | 8 +--
26 files changed, 268 insertions(+), 183 deletions(-)
create mode 100644 libavdevice/packet_list.c
create mode 100644 libavformat/packet_internal.h
create mode 100644 libavformat/packet_list.c
diff --git a/libavcodec/packet.c b/libavcodec/packet.c
index deb369ff05..49b5a814e3 100644
--- a/libavcodec/packet.c
+++ b/libavcodec/packet.c
@@ -545,82 +545,6 @@ void av_packet_rescale_ts(AVPacket *pkt, AVRational src_tb, AVRational dst_tb)
pkt->duration = av_rescale_q(pkt->duration, src_tb, dst_tb);
}
-int avpriv_packet_list_put(PacketList *packet_buffer,
- AVPacket *pkt,
- int (*copy)(AVPacket *dst, const AVPacket *src),
- int flags)
-{
- PacketListEntry *pktl = av_malloc(sizeof(*pktl));
- unsigned int update_end_point = 1;
- int ret;
-
- if (!pktl)
- return AVERROR(ENOMEM);
-
- if (copy) {
- get_packet_defaults(&pktl->pkt);
- ret = copy(&pktl->pkt, pkt);
- if (ret < 0) {
- av_free(pktl);
- return ret;
- }
- } else {
- ret = av_packet_make_refcounted(pkt);
- if (ret < 0) {
- av_free(pktl);
- return ret;
- }
- av_packet_move_ref(&pktl->pkt, pkt);
- }
-
- pktl->next = NULL;
-
- if (packet_buffer->head) {
- if (flags & FF_PACKETLIST_FLAG_PREPEND) {
- pktl->next = packet_buffer->head;
- packet_buffer->head = pktl;
- update_end_point = 0;
- } else {
- packet_buffer->tail->next = pktl;
- }
- } else
- packet_buffer->head = pktl;
-
- if (update_end_point) {
- /* Add the packet in the buffered packet list. */
- packet_buffer->tail = pktl;
- }
-
- return 0;
-}
-
-int avpriv_packet_list_get(PacketList *pkt_buffer,
- AVPacket *pkt)
-{
- PacketListEntry *pktl = pkt_buffer->head;
- if (!pktl)
- return AVERROR(EAGAIN);
- *pkt = pktl->pkt;
- pkt_buffer->head = pktl->next;
- if (!pkt_buffer->head)
- pkt_buffer->tail = NULL;
- av_freep(&pktl);
- return 0;
-}
-
-void avpriv_packet_list_free(PacketList *pkt_buf)
-{
- PacketListEntry *tmp = pkt_buf->head;
-
- while (tmp) {
- PacketListEntry *pktl = tmp;
- tmp = pktl->next;
- av_packet_unref(&pktl->pkt);
- av_freep(&pktl);
- }
- pkt_buf->head = pkt_buf->tail = NULL;
-}
-
int ff_side_data_set_prft(AVPacket *pkt, int64_t timestamp)
{
AVProducerReferenceTime *prft;
diff --git a/libavcodec/packet_internal.h b/libavcodec/packet_internal.h
index 02471ed6df..dbaf744ee9 100644
--- a/libavcodec/packet_internal.h
+++ b/libavcodec/packet_internal.h
@@ -25,51 +25,6 @@
#define AVPACKET_IS_EMPTY(pkt) (!(pkt)->data && !(pkt)->side_data_elems)
-typedef struct PacketListEntry {
- struct PacketListEntry *next;
- AVPacket pkt;
-} PacketListEntry;
-
-typedef struct PacketList {
- PacketListEntry *head, *tail;
-} PacketList;
-
-#define FF_PACKETLIST_FLAG_PREPEND (1 << 0) /**< Prepend created AVPacketList instead of appending */
-
-/**
- * Append an AVPacket to the list.
- *
- * @param list A PacketList
- * @param pkt The packet being appended. The data described in it will
- * be made reference counted if it isn't already.
- * @param copy A callback to copy the contents of the packet to the list.
- May be null, in which case the packet's reference will be
- moved to the list.
- * @return 0 on success, negative AVERROR value on failure. On failure,
- the packet and the list are unchanged.
- */
-int avpriv_packet_list_put(PacketList *list, AVPacket *pkt,
- int (*copy)(AVPacket *dst, const AVPacket *src),
- int flags);
-
-/**
- * Remove the oldest AVPacket in the list and return it.
- *
- * @note The pkt will be overwritten completely on success. The caller
- * owns the packet and must unref it by itself.
- *
- * @param head A pointer to a PacketList struct
- * @param pkt Pointer to an AVPacket struct
- * @return 0 on success, and a packet is returned. AVERROR(EAGAIN) if
- * the list was empty.
- */
-int avpriv_packet_list_get(PacketList *list, AVPacket *pkt);
-
-/**
- * Wipe the list and unref all the packets in it.
- */
-void avpriv_packet_list_free(PacketList *list);
-
int ff_side_data_set_prft(AVPacket *pkt, int64_t timestamp);
#endif // AVCODEC_PACKET_INTERNAL_H
diff --git a/libavdevice/Makefile b/libavdevice/Makefile
index a226368d16..256c8e7bea 100644
--- a/libavdevice/Makefile
+++ b/libavdevice/Makefile
@@ -53,8 +53,8 @@ OBJS-$(CONFIG_LIBCDIO_INDEV) += libcdio.o
OBJS-$(CONFIG_LIBDC1394_INDEV) += libdc1394.o
# Objects duplicated from other libraries for shared builds
-SHLIBOBJS-$(CONFIG_DECKLINK_INDEV) += reverse.o
-SHLIBOBJS-$(CONFIG_DECKLINK_OUTDEV) += ccfifo.o
+SHLIBOBJS-$(CONFIG_DECKLINK_INDEV) += reverse.o packet_list.o
+SHLIBOBJS-$(CONFIG_DECKLINK_OUTDEV) += ccfifo.o packet_list.o
# Windows resource file
SHLIBOBJS-$(HAVE_GNU_WINDRES) += avdeviceres.o
diff --git a/libavdevice/decklink_common.cpp b/libavdevice/decklink_common.cpp
index fe187cd2c9..9d81174630 100644
--- a/libavdevice/decklink_common.cpp
+++ b/libavdevice/decklink_common.cpp
@@ -409,7 +409,7 @@ void ff_decklink_packet_queue_flush(DecklinkPacketQueue *q)
AVPacket pkt;
pthread_mutex_lock(&q->mutex);
- while (avpriv_packet_list_get(&q->pkt_list, &pkt) == 0) {
+ while (ff_packet_list_get(&q->pkt_list, &pkt) == 0) {
av_packet_unref(&pkt);
}
q->nb_packets = 0;
@@ -452,7 +452,7 @@ int ff_decklink_packet_queue_put(DecklinkPacketQueue *q, AVPacket *pkt)
pthread_mutex_lock(&q->mutex);
- ret = avpriv_packet_list_put(&q->pkt_list, pkt, NULL, 0);
+ ret = ff_packet_list_put(&q->pkt_list, pkt, NULL, 0);
if (ret == 0) {
q->nb_packets++;
q->size += pkt_size + sizeof(AVPacket);
@@ -472,7 +472,7 @@ int ff_decklink_packet_queue_get(DecklinkPacketQueue *q, AVPacket *pkt, int bloc
pthread_mutex_lock(&q->mutex);
for (;; ) {
- ret = avpriv_packet_list_get(&q->pkt_list, pkt);
+ ret = ff_packet_list_get(&q->pkt_list, pkt);
if (ret == 0) {
q->nb_packets--;
q->size -= pkt->size + sizeof(AVPacket);
diff --git a/libavdevice/decklink_common.h b/libavdevice/decklink_common.h
index 095b438bce..11430787ce 100644
--- a/libavdevice/decklink_common.h
+++ b/libavdevice/decklink_common.h
@@ -48,7 +48,7 @@
extern "C" {
#include "libavutil/mem.h"
-#include "libavcodec/packet_internal.h"
+#include "libavformat/packet_internal.h"
#include "libavfilter/ccfifo.h"
}
#include "libavutil/thread.h"
diff --git a/libavdevice/decklink_dec.cpp b/libavdevice/decklink_dec.cpp
index 8830779990..d1b7a67cd6 100644
--- a/libavdevice/decklink_dec.cpp
+++ b/libavdevice/decklink_dec.cpp
@@ -39,7 +39,7 @@ extern "C" {
extern "C" {
#include "config.h"
-#include "libavcodec/packet_internal.h"
+#include "libavformat/packet_internal.h"
#include "libavformat/avformat.h"
#include "libavutil/avassert.h"
#include "libavutil/avutil.h"
diff --git a/libavdevice/dshow_capture.h b/libavdevice/dshow_capture.h
index bb39d4947a..056d821aa0 100644
--- a/libavdevice/dshow_capture.h
+++ b/libavdevice/dshow_capture.h
@@ -33,7 +33,7 @@
#include <dvdmedia.h>
#include "libavcodec/internal.h"
-#include "libavcodec/packet_internal.h"
+#include "libavformat/packet_internal.h"
/* EC_DEVICE_LOST is not defined in MinGW dshow headers. */
#ifndef EC_DEVICE_LOST
diff --git a/libavdevice/packet_list.c b/libavdevice/packet_list.c
new file mode 100644
index 0000000000..fbccf65fbd
--- /dev/null
+++ b/libavdevice/packet_list.c
@@ -0,0 +1,22 @@
+/*
+ * 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
+ */
+
+/* decklink is the only libavdevice user of the ff_packet_list_*() API, which
+ * lives in libavformat; compile a private copy into libavdevice for shared
+ * builds (static builds resolve the symbols from libavformat). */
+#include "libavformat/packet_list.c"
diff --git a/libavdevice/vfwcap.c b/libavdevice/vfwcap.c
index 1fda90efa1..888436bcd2 100644
--- a/libavdevice/vfwcap.c
+++ b/libavdevice/vfwcap.c
@@ -25,7 +25,7 @@
#include "libavutil/opt.h"
#include "libavutil/parseutils.h"
-#include "libavcodec/packet_internal.h"
+#include "libavformat/packet_internal.h"
#include "libavformat/demux.h"
#include "libavformat/internal.h"
diff --git a/libavformat/Makefile b/libavformat/Makefile
index 0db0c7c2a9..752436cf5f 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -27,6 +27,7 @@ OBJS = allformats.o \
nal.o \
options.o \
os_support.o \
+ packet_list.o \
protocols.o \
riff.o \
sdp.o \
diff --git a/libavformat/aiffenc.c b/libavformat/aiffenc.c
index db65c09f11..3368e28404 100644
--- a/libavformat/aiffenc.c
+++ b/libavformat/aiffenc.c
@@ -23,7 +23,7 @@
#include "libavutil/intfloat.h"
#include "libavutil/opt.h"
-#include "libavcodec/packet_internal.h"
+#include "packet_internal.h"
#include "avformat.h"
#include "internal.h"
#include "aiff.h"
@@ -223,7 +223,7 @@ static int aiff_write_packet(AVFormatContext *s, AVPacket *pkt)
if (s->streams[pkt->stream_index]->nb_frames >= 1)
return 0;
- return avpriv_packet_list_put(&aiff->pict_list, pkt, NULL, 0);
+ return ff_packet_list_put(&aiff->pict_list, pkt, NULL, 0);
}
return 0;
@@ -269,7 +269,7 @@ static void aiff_deinit(AVFormatContext *s)
{
AIFFOutputContext *aiff = s->priv_data;
- avpriv_packet_list_free(&aiff->pict_list);
+ ff_packet_list_free(&aiff->pict_list);
}
#define OFFSET(x) offsetof(AIFFOutputContext, x)
diff --git a/libavformat/avformat.c b/libavformat/avformat.c
index 15806aa6f6..bb574e0c7b 100644
--- a/libavformat/avformat.c
+++ b/libavformat/avformat.c
@@ -33,7 +33,7 @@
#include "libavcodec/codec.h"
#include "libavcodec/bsf.h"
#include "libavcodec/codec_desc.h"
-#include "libavcodec/packet_internal.h"
+#include "packet_internal.h"
#include "avformat.h"
#include "avformat_internal.h"
#include "avio.h"
@@ -138,9 +138,9 @@ void ff_flush_packet_queue(AVFormatContext *s)
{
FormatContextInternal *const fci = ff_fc_internal(s);
FFFormatContext *const si = &fci->fc;
- avpriv_packet_list_free(&fci->parse_queue);
- avpriv_packet_list_free(&si->packet_buffer);
- avpriv_packet_list_free(&fci->raw_packet_buffer);
+ ff_packet_list_free(&fci->parse_queue);
+ ff_packet_list_free(&si->packet_buffer);
+ ff_packet_list_free(&fci->raw_packet_buffer);
fci->raw_packet_buffer_size = 0;
}
@@ -189,7 +189,7 @@ void avformat_free_context(AVFormatContext *s)
av_dict_free(&si->id3v2_meta);
av_packet_free(&si->pkt);
av_packet_free(&si->parse_pkt);
- avpriv_packet_list_free(&si->packet_buffer);
+ ff_packet_list_free(&si->packet_buffer);
av_freep(&s->streams);
av_freep(&s->stream_groups);
if (s->iformat)
diff --git a/libavformat/demux.c b/libavformat/demux.c
index 516f286e19..193fd17739 100644
--- a/libavformat/demux.c
+++ b/libavformat/demux.c
@@ -39,7 +39,7 @@
#include "libavcodec/bsf.h"
#include "libavcodec/codec_desc.h"
#include "libavcodec/internal.h"
-#include "libavcodec/packet_internal.h"
+#include "packet_internal.h"
#include "libavcodec/raw.h"
#include "avformat.h"
@@ -603,7 +603,7 @@ static int handle_new_packet(AVFormatContext *s, AVPacket *pkt, int allow_passth
if (sti->request_probe <= 0 && allow_passthrough && !fci->raw_packet_buffer.head)
return 0;
- err = avpriv_packet_list_put(&fci->raw_packet_buffer, pkt, NULL, 0);
+ err = ff_packet_list_put(&fci->raw_packet_buffer, pkt, NULL, 0);
if (err < 0) {
av_packet_unref(pkt);
return err;
@@ -650,7 +650,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
if ((err = probe_codec(s, st, NULL)) < 0)
return err;
if (ffstream(st)->request_probe <= 0) {
- avpriv_packet_list_get(&fci->raw_packet_buffer, pkt);
+ ff_packet_list_get(&fci->raw_packet_buffer, pkt);
fci->raw_packet_buffer_size -= pkt->size;
return 0;
}
@@ -1195,7 +1195,7 @@ static int parse_packet(AVFormatContext *s, AVPacket *pkt,
// Theora has valid 0-sized packets that need to be output
if (st->codecpar->codec_id == AV_CODEC_ID_THEORA) {
- ret = avpriv_packet_list_put(&fci->parse_queue,
+ ret = ff_packet_list_put(&fci->parse_queue,
pkt, NULL, 0);
if (ret < 0)
goto fail;
@@ -1303,7 +1303,7 @@ static int parse_packet(AVFormatContext *s, AVPacket *pkt,
compute_pkt_fields(s, st, sti->parser, out_pkt, next_dts, next_pts);
- ret = avpriv_packet_list_put(&fci->parse_queue,
+ ret = ff_packet_list_put(&fci->parse_queue,
out_pkt, NULL, 0);
if (ret < 0)
goto fail;
@@ -1527,7 +1527,7 @@ static int read_frame_internal(AVFormatContext *s, AVPacket *pkt)
}
if (!got_packet && fci->parse_queue.head)
- ret = avpriv_packet_list_get(&fci->parse_queue, pkt);
+ ret = ff_packet_list_get(&fci->parse_queue, pkt);
if (ret >= 0) {
AVStream *const st = s->streams[pkt->stream_index];
@@ -1595,7 +1595,7 @@ int av_read_frame(AVFormatContext *s, AVPacket *pkt)
if (!genpts) {
ret = si->packet_buffer.head
- ? avpriv_packet_list_get(&si->packet_buffer, pkt)
+ ? ff_packet_list_get(&si->packet_buffer, pkt)
: read_frame_internal(s, pkt);
if (ret < 0)
return ret;
@@ -1643,7 +1643,7 @@ int av_read_frame(AVFormatContext *s, AVPacket *pkt)
st = s->streams[next_pkt->stream_index];
if (!(next_pkt->pts == AV_NOPTS_VALUE && st->discard < AVDISCARD_ALL &&
next_pkt->dts != AV_NOPTS_VALUE && !eof)) {
- ret = avpriv_packet_list_get(&si->packet_buffer, pkt);
+ ret = ff_packet_list_get(&si->packet_buffer, pkt);
goto return_packet;
}
}
@@ -1657,7 +1657,7 @@ int av_read_frame(AVFormatContext *s, AVPacket *pkt)
return ret;
}
- ret = avpriv_packet_list_put(&si->packet_buffer,
+ ret = ff_packet_list_put(&si->packet_buffer,
pkt, NULL, 0);
if (ret < 0) {
av_packet_unref(pkt);
@@ -2808,7 +2808,7 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
}
if (!(ic->flags & AVFMT_FLAG_NOBUFFER)) {
- ret = avpriv_packet_list_put(&si->packet_buffer,
+ ret = ff_packet_list_put(&si->packet_buffer,
pkt1, NULL, 0);
if (ret < 0)
goto unref_then_goto_end;
diff --git a/libavformat/demux_utils.c b/libavformat/demux_utils.c
index 639fed35fd..0f22304e56 100644
--- a/libavformat/demux_utils.c
+++ b/libavformat/demux_utils.c
@@ -23,7 +23,7 @@
#include "libavutil/avassert.h"
#include "libavcodec/bytestream.h"
-#include "libavcodec/packet_internal.h"
+#include "packet_internal.h"
#include "avformat.h"
#include "avformat_internal.h"
#include "avio_internal.h"
@@ -95,7 +95,7 @@ int avformat_queue_attached_pictures(AVFormatContext *s)
continue;
}
- ret = avpriv_packet_list_put(&fci->raw_packet_buffer,
+ ret = ff_packet_list_put(&fci->raw_packet_buffer,
&s->streams[i]->attached_pic,
av_packet_ref, 0);
if (ret < 0)
diff --git a/libavformat/flacenc.c b/libavformat/flacenc.c
index 711119efec..5397213fa5 100644
--- a/libavformat/flacenc.c
+++ b/libavformat/flacenc.c
@@ -24,7 +24,7 @@
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#include "libavcodec/flac.h"
-#include "libavcodec/packet_internal.h"
+#include "packet_internal.h"
#include "avformat.h"
#include "avio_internal.h"
#include "flacenc.h"
@@ -311,7 +311,7 @@ static int flac_queue_flush(AVFormatContext *s)
write = 0;
while (c->queue.head) {
- avpriv_packet_list_get(&c->queue, pkt);
+ ff_packet_list_get(&c->queue, pkt);
if (write && (ret = flac_write_audio_packet(s, pkt)) < 0)
write = 0;
av_packet_unref(pkt);
@@ -351,7 +351,7 @@ static void flac_deinit(struct AVFormatContext *s)
{
FlacMuxerContext *c = s->priv_data;
- avpriv_packet_list_free(&c->queue);
+ ff_packet_list_free(&c->queue);
for (unsigned i = 0; i < s->nb_streams; i++)
av_packet_free((AVPacket **)&s->streams[i]->priv_data);
}
@@ -364,7 +364,7 @@ static int flac_write_packet(struct AVFormatContext *s, AVPacket *pkt)
if (pkt->stream_index == c->audio_stream_idx) {
if (c->waiting_pics) {
/* buffer audio packets until we get all the pictures */
- ret = avpriv_packet_list_put(&c->queue, pkt, NULL, 0);
+ ret = ff_packet_list_put(&c->queue, pkt, NULL, 0);
if (ret < 0) {
av_log(s, AV_LOG_ERROR, "Out of memory in packet queue; skipping attached pictures\n");
c->waiting_pics = 0;
diff --git a/libavformat/internal.h b/libavformat/internal.h
index 4f46c19808..a04343989b 100644
--- a/libavformat/internal.h
+++ b/libavformat/internal.h
@@ -23,7 +23,7 @@
#include <stdint.h>
-#include "libavcodec/packet_internal.h"
+#include "packet_internal.h"
#include "avformat.h"
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index 90fdb6c8ae..18849af689 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -57,7 +57,7 @@
#include "libavcodec/flac.h"
#include "libavcodec/itut35.h"
#include "libavcodec/mpeg4audio.h"
-#include "libavcodec/packet_internal.h"
+#include "packet_internal.h"
#include "avformat.h"
#include "avio_internal.h"
@@ -3584,7 +3584,7 @@ static int matroska_deliver_packet(MatroskaDemuxContext *matroska,
MatroskaTrack *tracks = matroska->tracks.elem;
MatroskaTrack *track;
- avpriv_packet_list_get(&matroska->queue, pkt);
+ ff_packet_list_get(&matroska->queue, pkt);
track = &tracks[pkt->stream_index];
if (track->has_palette) {
uint8_t *pal = av_packet_new_side_data(pkt, AV_PKT_DATA_PALETTE, AVPALETTE_SIZE);
@@ -3606,7 +3606,7 @@ static int matroska_deliver_packet(MatroskaDemuxContext *matroska,
*/
static void matroska_clear_queue(MatroskaDemuxContext *matroska)
{
- avpriv_packet_list_free(&matroska->queue);
+ ff_packet_list_free(&matroska->queue);
}
static int matroska_parse_laces(MatroskaDemuxContext *matroska, uint8_t **buf,
@@ -3772,7 +3772,7 @@ static int matroska_parse_rm_audio(MatroskaDemuxContext *matroska,
track->audio.buf_timecode = AV_NOPTS_VALUE;
pkt->pos = pos;
pkt->stream_index = st->index;
- ret = avpriv_packet_list_put(&matroska->queue, pkt, NULL, 0);
+ ret = ff_packet_list_put(&matroska->queue, pkt, NULL, 0);
if (ret < 0) {
av_packet_unref(pkt);
return AVERROR(ENOMEM);
@@ -3991,7 +3991,7 @@ static int matroska_parse_webvtt(MatroskaDemuxContext *matroska,
pkt->duration = duration;
pkt->pos = pos;
- err = avpriv_packet_list_put(&matroska->queue, pkt, NULL, 0);
+ err = ff_packet_list_put(&matroska->queue, pkt, NULL, 0);
if (err < 0) {
av_packet_unref(pkt);
return AVERROR(ENOMEM);
@@ -4255,7 +4255,7 @@ static int matroska_parse_frame(MatroskaDemuxContext *matroska,
pkt->pos = pos;
pkt->duration = lace_duration;
- res = avpriv_packet_list_put(&matroska->queue, pkt, NULL, 0);
+ res = ff_packet_list_put(&matroska->queue, pkt, NULL, 0);
if (res < 0) {
av_packet_unref(pkt);
return AVERROR(ENOMEM);
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index d5247ad45e..66820b3c7b 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -7660,7 +7660,7 @@ static int mov_write_packet(AVFormatContext *s, AVPacket *pkt)
/* The following will reset pkt and is only allowed to be used
* because we return immediately. afterwards. */
- if ((ret = avpriv_packet_list_put(&trk->squashed_packet_queue,
+ if ((ret = ff_packet_list_put(&trk->squashed_packet_queue,
pkt, NULL, 0)) < 0) {
return ret;
}
@@ -7960,7 +7960,7 @@ static void mov_free(AVFormatContext *s)
#endif
ff_isom_close_apvc(&track->apv);
- avpriv_packet_list_free(&track->squashed_packet_queue);
+ ff_packet_list_free(&track->squashed_packet_queue);
}
av_freep(&mov->tracks);
diff --git a/libavformat/movenc.h b/libavformat/movenc.h
index 12b591b4da..5d1e7099b4 100644
--- a/libavformat/movenc.h
+++ b/libavformat/movenc.h
@@ -26,7 +26,7 @@
#include "avformat.h"
#include "movenccenc.h"
-#include "libavcodec/packet_internal.h"
+#include "packet_internal.h"
#define MOV_FRAG_INFO_ALLOC_INCREMENT 64
#define MOV_INDEX_CLUSTER_SIZE 1024
diff --git a/libavformat/movenc_ttml.c b/libavformat/movenc_ttml.c
index ff09c14fa2..5d6d5f71be 100644
--- a/libavformat/movenc_ttml.c
+++ b/libavformat/movenc_ttml.c
@@ -25,7 +25,7 @@
#include "isom.h"
#include "movenc.h"
#include "movenc_ttml.h"
-#include "libavcodec/packet_internal.h"
+#include "packet_internal.h"
static const unsigned char empty_ttml_document[] =
"<tt xml:lang=\"\" xmlns=\"http://www.w3.org/ns/ttml\" />";
@@ -122,7 +122,7 @@ static int mov_write_ttml_document_from_queue(AVFormatContext *s,
return ret;
}
- while (!avpriv_packet_list_get(&track->squashed_packet_queue, pkt)) {
+ while (!ff_packet_list_get(&track->squashed_packet_queue, pkt)) {
int64_t pts_before = pkt->pts;
int64_t duration_before = pkt->duration;
@@ -139,7 +139,7 @@ static int mov_write_ttml_document_from_queue(AVFormatContext *s,
continue;
} else if (pkt->pts >= end_ts) {
// starts after this fragment, put back to original queue
- ret = avpriv_packet_list_put(&track->squashed_packet_queue,
+ ret = ff_packet_list_put(&track->squashed_packet_queue,
pkt, NULL,
FF_PACKETLIST_FLAG_PREPEND);
if (ret < 0)
@@ -160,7 +160,7 @@ static int mov_write_ttml_document_from_queue(AVFormatContext *s,
// order to handle multiple subtitles at the same time.
int64_t offset = end_ts - pkt->pts;
- ret = avpriv_packet_list_put(&back_to_queue_list,
+ ret = ff_packet_list_put(&back_to_queue_list,
pkt, av_packet_ref,
FF_PACKETLIST_FLAG_PREPEND);
if (ret < 0)
@@ -216,8 +216,8 @@ static int mov_write_ttml_document_from_queue(AVFormatContext *s,
cleanup:
av_packet_unref(pkt);
- while (!avpriv_packet_list_get(&back_to_queue_list, pkt)) {
- ret = avpriv_packet_list_put(&track->squashed_packet_queue,
+ while (!ff_packet_list_get(&back_to_queue_list, pkt)) {
+ ret = ff_packet_list_put(&track->squashed_packet_queue,
pkt, av_packet_ref,
FF_PACKETLIST_FLAG_PREPEND);
@@ -226,7 +226,7 @@ cleanup:
av_packet_unref(pkt);
if (ret < 0) {
- avpriv_packet_list_free(&back_to_queue_list);
+ ff_packet_list_free(&back_to_queue_list);
break;
}
}
diff --git a/libavformat/mp3enc.c b/libavformat/mp3enc.c
index 724c7269dc..87c13f92bd 100644
--- a/libavformat/mp3enc.c
+++ b/libavformat/mp3enc.c
@@ -30,7 +30,7 @@
#include "libavcodec/mpegaudio.h"
#include "libavcodec/mpegaudiodata.h"
#include "libavcodec/mpegaudiodecheader.h"
-#include "libavcodec/packet_internal.h"
+#include "packet_internal.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/opt.h"
#include "libavutil/dict.h"
@@ -389,7 +389,7 @@ static int mp3_queue_flush(AVFormatContext *s)
mp3_write_xing(s);
while (mp3->queue.head) {
- avpriv_packet_list_get(&mp3->queue, pkt);
+ ff_packet_list_get(&mp3->queue, pkt);
if (write && (ret = mp3_write_audio_packet(s, pkt)) < 0)
write = 0;
av_packet_unref(pkt);
@@ -531,7 +531,7 @@ static int mp3_write_packet(AVFormatContext *s, AVPacket *pkt)
if (pkt->stream_index == mp3->audio_stream_idx) {
if (mp3->pics_to_write) {
/* buffer audio packets until we get all the pictures */
- int ret = avpriv_packet_list_put(&mp3->queue, pkt, NULL, 0);
+ int ret = ff_packet_list_put(&mp3->queue, pkt, NULL, 0);
if (ret < 0) {
av_log(s, AV_LOG_WARNING, "Not enough memory to buffer audio. Skipping picture streams\n");
@@ -639,7 +639,7 @@ static void mp3_deinit(struct AVFormatContext *s)
{
MP3Context *mp3 = s->priv_data;
- avpriv_packet_list_free(&mp3->queue);
+ ff_packet_list_free(&mp3->queue);
av_freep(&mp3->xing_frame);
}
diff --git a/libavformat/mux.c b/libavformat/mux.c
index 363e5e1a57..ea9838e380 100644
--- a/libavformat/mux.c
+++ b/libavformat/mux.c
@@ -27,7 +27,7 @@
#include "libavcodec/bsf.h"
#include "libavcodec/codec_desc.h"
#include "libavcodec/internal.h"
-#include "libavcodec/packet_internal.h"
+#include "packet_internal.h"
#include "libavutil/mem.h"
#include "libavutil/opt.h"
#include "libavutil/dict.h"
@@ -1010,7 +1010,7 @@ int ff_interleave_packet_per_dts(AVFormatContext *s, AVPacket *pkt,
if (sti->last_in_packet_buffer == pktl)
sti->last_in_packet_buffer = NULL;
- avpriv_packet_list_get(&si->packet_buffer, pkt);
+ ff_packet_list_get(&si->packet_buffer, pkt);
return 1;
} else {
diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c
index 1552d24e0c..48043a7d47 100644
--- a/libavformat/mxfenc.c
+++ b/libavformat/mxfenc.c
@@ -55,7 +55,7 @@
#include "libavcodec/golomb.h"
#include "libavcodec/h264.h"
#include "libavcodec/jpeg2000.h"
-#include "libavcodec/packet_internal.h"
+#include "packet_internal.h"
#include "libavcodec/rangecoder.h"
#include "libavcodec/startcode.h"
#include "avformat.h"
@@ -3596,7 +3596,7 @@ static int mxf_interleave_get_packet(AVFormatContext *s, AVPacket *out, int flus
if (ffstream(s->streams[pktl->pkt.stream_index])->last_in_packet_buffer == pktl)
ffstream(s->streams[pktl->pkt.stream_index])->last_in_packet_buffer = NULL;
- avpriv_packet_list_get(&si->packet_buffer, out);
+ ff_packet_list_get(&si->packet_buffer, out);
av_log(s, AV_LOG_TRACE, "out st:%d dts:%"PRId64"\n", out->stream_index, out->dts);
return 1;
} else {
diff --git a/libavformat/packet_internal.h b/libavformat/packet_internal.h
new file mode 100644
index 0000000000..1f6ab56a4f
--- /dev/null
+++ b/libavformat/packet_internal.h
@@ -0,0 +1,69 @@
+/*
+ * 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 AVFORMAT_PACKET_INTERNAL_H
+#define AVFORMAT_PACKET_INTERNAL_H
+
+#include "libavcodec/packet.h"
+
+typedef struct PacketListEntry {
+ struct PacketListEntry *next;
+ AVPacket pkt;
+} PacketListEntry;
+
+typedef struct PacketList {
+ PacketListEntry *head, *tail;
+} PacketList;
+
+#define FF_PACKETLIST_FLAG_PREPEND (1 << 0) /**< Prepend created AVPacketList instead of appending */
+
+/**
+ * Append an AVPacket to the list.
+ *
+ * @param list A PacketList
+ * @param pkt The packet being appended. The data described in it will
+ * be made reference counted if it isn't already.
+ * @param copy A callback to copy the contents of the packet to the list.
+ May be null, in which case the packet's reference will be
+ moved to the list.
+ * @return 0 on success, negative AVERROR value on failure. On failure,
+ the packet and the list are unchanged.
+ */
+int ff_packet_list_put(PacketList *list, AVPacket *pkt,
+ int (*copy)(AVPacket *dst, const AVPacket *src),
+ int flags);
+
+/**
+ * Remove the oldest AVPacket in the list and return it.
+ *
+ * @note The pkt will be overwritten completely on success. The caller
+ * owns the packet and must unref it by itself.
+ *
+ * @param head A pointer to a PacketList struct
+ * @param pkt Pointer to an AVPacket struct
+ * @return 0 on success, and a packet is returned. AVERROR(EAGAIN) if
+ * the list was empty.
+ */
+int ff_packet_list_get(PacketList *list, AVPacket *pkt);
+
+/**
+ * Wipe the list and unref all the packets in it.
+ */
+void ff_packet_list_free(PacketList *list);
+
+#endif // AVFORMAT_PACKET_INTERNAL_H
diff --git a/libavformat/packet_list.c b/libavformat/packet_list.c
new file mode 100644
index 0000000000..13c0552af6
--- /dev/null
+++ b/libavformat/packet_list.c
@@ -0,0 +1,114 @@
+/*
+ * 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 <string.h>
+
+#include "libavutil/avutil.h"
+#include "libavutil/error.h"
+#include "libavutil/mem.h"
+#include "libavutil/rational.h"
+
+#include "libavcodec/packet.h"
+
+#include "packet_internal.h"
+
+static void get_packet_defaults(AVPacket *pkt)
+{
+ memset(pkt, 0, sizeof(*pkt));
+
+ pkt->pts = AV_NOPTS_VALUE;
+ pkt->dts = AV_NOPTS_VALUE;
+ pkt->pos = -1;
+ pkt->time_base = av_make_q(0, 1);
+}
+
+int ff_packet_list_put(PacketList *packet_buffer,
+ AVPacket *pkt,
+ int (*copy)(AVPacket *dst, const AVPacket *src),
+ int flags)
+{
+ PacketListEntry *pktl = av_malloc(sizeof(*pktl));
+ unsigned int update_end_point = 1;
+ int ret;
+
+ if (!pktl)
+ return AVERROR(ENOMEM);
+
+ if (copy) {
+ get_packet_defaults(&pktl->pkt);
+ ret = copy(&pktl->pkt, pkt);
+ if (ret < 0) {
+ av_free(pktl);
+ return ret;
+ }
+ } else {
+ ret = av_packet_make_refcounted(pkt);
+ if (ret < 0) {
+ av_free(pktl);
+ return ret;
+ }
+ av_packet_move_ref(&pktl->pkt, pkt);
+ }
+
+ pktl->next = NULL;
+
+ if (packet_buffer->head) {
+ if (flags & FF_PACKETLIST_FLAG_PREPEND) {
+ pktl->next = packet_buffer->head;
+ packet_buffer->head = pktl;
+ update_end_point = 0;
+ } else {
+ packet_buffer->tail->next = pktl;
+ }
+ } else
+ packet_buffer->head = pktl;
+
+ if (update_end_point) {
+ /* Add the packet in the buffered packet list. */
+ packet_buffer->tail = pktl;
+ }
+
+ return 0;
+}
+
+int ff_packet_list_get(PacketList *pkt_buffer,
+ AVPacket *pkt)
+{
+ PacketListEntry *pktl = pkt_buffer->head;
+ if (!pktl)
+ return AVERROR(EAGAIN);
+ *pkt = pktl->pkt;
+ pkt_buffer->head = pktl->next;
+ if (!pkt_buffer->head)
+ pkt_buffer->tail = NULL;
+ av_freep(&pktl);
+ return 0;
+}
+
+void ff_packet_list_free(PacketList *pkt_buf)
+{
+ PacketListEntry *tmp = pkt_buf->head;
+
+ while (tmp) {
+ PacketListEntry *pktl = tmp;
+ tmp = pktl->next;
+ av_packet_unref(&pktl->pkt);
+ av_freep(&pktl);
+ }
+ pkt_buf->head = pkt_buf->tail = NULL;
+}
diff --git a/libavformat/ttaenc.c b/libavformat/ttaenc.c
index efc5aac88c..b7eb2c5130 100644
--- a/libavformat/ttaenc.c
+++ b/libavformat/ttaenc.c
@@ -22,7 +22,7 @@
#include "libavutil/crc.h"
#include "libavutil/intreadwrite.h"
-#include "libavcodec/packet_internal.h"
+#include "packet_internal.h"
#include "apetag.h"
#include "avformat.h"
#include "avio_internal.h"
@@ -89,7 +89,7 @@ static int tta_write_packet(AVFormatContext *s, AVPacket *pkt)
TTAMuxContext *tta = s->priv_data;
int ret;
- ret = avpriv_packet_list_put(&tta->queue, pkt, NULL, 0);
+ ret = ff_packet_list_put(&tta->queue, pkt, NULL, 0);
if (ret < 0) {
return ret;
}
@@ -121,7 +121,7 @@ static void tta_queue_flush(AVFormatContext *s)
AVPacket *const pkt = ffformatcontext(s)->pkt;
while (tta->queue.head) {
- avpriv_packet_list_get(&tta->queue, pkt);
+ ff_packet_list_get(&tta->queue, pkt);
avio_write(s->pb, pkt->data, pkt->size);
av_packet_unref(pkt);
}
@@ -157,7 +157,7 @@ static void tta_deinit(AVFormatContext *s)
TTAMuxContext *tta = s->priv_data;
ffio_free_dyn_buf(&tta->seek_table);
- avpriv_packet_list_free(&tta->queue);
+ ff_packet_list_free(&tta->queue);
}
const FFOutputFormat ff_tta_muxer = {
--
2.52.0
From 4629788eba19fc9fcc610f25221a08aad6c43b69 Mon Sep 17 00:00:00 2001
From: Michael Niedermayer <michael(a)niedermayer.cc>
Date: Sun, 21 Jun 2026 12:40:54 +0200
Subject: [PATCH 33/33] doc/protocols: TLS verification is now enabled by
default
Since FF_API_NO_DEFAULT_TLS_VERIFY was removed and the tls_verify/verify
option now defaults to 1, both TLS client-option sections must no longer
state that verification is disabled by default.
---
doc/protocols.texi | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/doc/protocols.texi b/doc/protocols.texi
index 0ac28e78b5..368ae005f8 100644
--- a/doc/protocols.texi
+++ b/doc/protocols.texi
@@ -2085,8 +2085,8 @@ database, but it does not validate that the certificate actually
matches the host name we are trying to connect to. (With other backends,
the host name is validated as well.)
-This is disabled by default since it requires a CA database to be
-provided by the caller in many cases.
+This is enabled by default. Verifying the peer requires a CA database,
+which in some cases has to be provided by the caller.
@item cert_file, cert=@var{filename}
A file containing a certificate to use in the handshake with the peer.
@@ -2157,8 +2157,8 @@ peer certificate is signed by one of the root certificates in the CA
database, but it does not validate that the certificate actually
matches the host name we are trying to connect to.
-This is disabled by default since it requires a CA database to be
-provided by the caller in many cases.
+This is enabled by default. Verifying the peer requires a CA database,
+which in some cases has to be provided by the caller.
@item cert_file, cert=@var{filename}
A file containing a certificate to use in the handshake with the peer.
--
2.52.0
1
0
20 Jun '26
PR #23543 opened by catap
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/23543
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/23543.patch
The existing x86_32_7regs probe keeps HAVE_7REGS from
relying on the EBP crash probe. HAVE_6REGS still used
HAVE_EBX_AVAILABLE || HAVE_EBP_AVAILABLE, which has the same
problem: an EBP clobber probe can pass even when the compiler
cannot allocate the multi-register asm patterns guarded by
HAVE_6REGS.
Add an x86_32_6regs probe and use it for HAVE_6REGS.
# Summary of changes
Briefly describe what this PR does and why.
<!--
If this PR requires new FATE test samples, attach them to the PR and
list their target paths below (relative to the fate-suite root).
Attached filenames must match the sample's filename:
```fate-samples
# e.g. vorbis/new-sample.ogg
```
-->
From a267e61bca0a1c47fd3266d62bbe0a75c015fe12 Mon Sep 17 00:00:00 2001
From: "Kirill A. Korinsky" <kirill(a)korins.ky>
Date: Sat, 20 Jun 2026 23:42:55 +0200
Subject: [PATCH] configure/x86: test 6-register inline asm separately
The existing x86_32_7regs probe keeps HAVE_7REGS from
relying on the EBP crash probe. HAVE_6REGS still used
HAVE_EBX_AVAILABLE || HAVE_EBP_AVAILABLE, which has the same
problem: an EBP clobber probe can pass even when the compiler
cannot allocate the multi-register asm patterns guarded by
HAVE_6REGS.
Add an x86_32_6regs probe and use it for HAVE_6REGS.
---
configure | 9 +++++++--
libavutil/x86/asm.h | 2 +-
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/configure b/configure
index a6bbb86807..26bf649788 100755
--- a/configure
+++ b/configure
@@ -2656,6 +2656,7 @@ TOOLCHAIN_FEATURES="
symver_asm_label
symver_gnu_asm
vfp_args
+ x86_32_6regs
x86_32_7regs
xform_asm
xmm_clobbers
@@ -6850,11 +6851,14 @@ EOF
check_inline_asm ebx_available '""::"b"(0)' &&
check_inline_asm ebx_available '"":::"%ebx"'
- # check whether 7 registers are available on x86-32
+ # check whether 6 and 7 registers are available on x86-32
# Since https://github.com/llvm/llvm-project/commit/0d471b3f64d3116bd57c79d872f7384…,
# Clang can save/restore EBP around clobber-only asm, so the EBP
- # crash probe alone can be a false positive for 7-register asm.
+ # crash probe alone can be a false positive for multi-register asm.
+ disable x86_32_6regs
disable x86_32_7regs
+ enabled x86_32 && enabled_any ebx_available ebp_available &&
+ check_inline_asm x86_32_6regs '"" :: "r"(0), "r"(1), "r"(2), "r"(3), "g"(4) : "%eax", "%edx"'
enabled_all x86_32 ebx_available ebp_available &&
check_inline_asm x86_32_7regs '"" :: "r"(0), "r"(1), "r"(2), "r"(3), "g"(4), "r"(5) : "%eax", "%edx"'
@@ -8519,6 +8523,7 @@ if enabled x86; then
echo "EBP available ${ebp_available-no}"
fi
if enabled x86_32; then
+ echo "6 registers available ${x86_32_6regs-no}"
echo "7 registers available ${x86_32_7regs-no}"
fi
if enabled aarch64; then
diff --git a/libavutil/x86/asm.h b/libavutil/x86/asm.h
index fc9f50b1a9..21b95cbba1 100644
--- a/libavutil/x86/asm.h
+++ b/libavutil/x86/asm.h
@@ -72,7 +72,7 @@ typedef int x86_reg;
#endif
#define HAVE_7REGS (ARCH_X86_64 || HAVE_X86_32_7REGS)
-#define HAVE_6REGS (ARCH_X86_64 || (HAVE_EBX_AVAILABLE || HAVE_EBP_AVAILABLE))
+#define HAVE_6REGS (ARCH_X86_64 || HAVE_X86_32_6REGS)
#if ARCH_X86_64 && defined(PIC)
# define BROKEN_RELOCATIONS 1
--
2.52.0
1
0