* [FFmpeg-devel] [PATCH 1/3] avcodec/tests/avcodec: Silence deprecation warnings
@ 2025-03-10 3:31 Andreas Rheinhardt
0 siblings, 0 replies; only message in thread
From: Andreas Rheinhardt @ 2025-03-10 3:31 UTC (permalink / raw)
To: FFmpeg development discussions and patches
[-- Attachment #1: Type: text/plain, Size: 29 bytes --]
Patches attached.
- Andreas
[-- Attachment #2: 0001-avcodec-tests-avcodec-Silence-deprecation-warnings.patch --]
[-- Type: text/x-patch, Size: 2423 bytes --]
From 32b1b86c68262a474493de2e109bdd4985b267dc Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Mon, 10 Mar 2025 03:45:28 +0100
Subject: [PATCH 1/3] avcodec/tests/avcodec: Silence deprecation warnings
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/tests/avcodec.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/libavcodec/tests/avcodec.c b/libavcodec/tests/avcodec.c
index cd949f6385..83a5d05316 100644
--- a/libavcodec/tests/avcodec.c
+++ b/libavcodec/tests/avcodec.c
@@ -77,17 +77,21 @@ 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)
ERR("Non-audio codec %s has audio-only fields set\n");
+FF_ENABLE_DEPRECATION_WARNINGS
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");
}
if (codec->type != AVMEDIA_TYPE_VIDEO) {
+FF_DISABLE_DEPRECATION_WARNINGS
if (codec->pix_fmts || codec->supported_framerates)
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");
}
@@ -136,10 +140,12 @@ int main(void){
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) {
av_log(NULL, AV_LOG_FATAL, "Encoder %s is missing the sample_fmts field\n", codec->name);
ret = 1;
}
+FF_ENABLE_DEPRECATION_WARNINGS
}
if (codec2->caps_internal & (FF_CODEC_CAP_USES_PROGRESSFRAMES |
FF_CODEC_CAP_SETS_PKT_DTS |
--
2.45.2
[-- Attachment #3: 0002-avcodec-allcodecs-Don-t-wrap-supported_framerates.patch --]
[-- Type: text/x-patch, Size: 1444 bytes --]
From 6b6786e5e9f574331eecd439e4794b4d795186cb Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Mon, 10 Mar 2025 03:48:47 +0100
Subject: [PATCH 2/3] avcodec/allcodecs: Don't wrap supported_framerates
Only two encoders (the native MPEG-1/2 ones) provide
supported_framerates and they don't implement the
get_supported_config callback. It is highly unlikely that
any codec will set supported_framerates dynamically at all,
so remove the code querying for frame rates.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/allcodecs.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index 3be33f5cc4..8605793c8f 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -941,10 +941,6 @@ FF_DISABLE_DEPRECATION_WARNINGS
AV_CODEC_CONFIG_PIX_FORMAT, 0,
(const void **) &codec->p.pix_fmts,
&dummy);
- codec->get_supported_config(NULL, &codec->p,
- AV_CODEC_CONFIG_FRAME_RATE, 0,
- (const void **) &codec->p.supported_framerates,
- &dummy);
break;
case AVMEDIA_TYPE_AUDIO:
codec->get_supported_config(NULL, &codec->p,
--
2.45.2
[-- Attachment #4: 0003-avcodec-mjpegenc-Reconstify-mjpeg-encoder.patch --]
[-- Type: text/x-patch, Size: 2406 bytes --]
From 241957a4865e23dbf4feadb36451d8f56339742e Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Mon, 10 Mar 2025 04:02:06 +0100
Subject: [PATCH 3/3] avcodec/mjpegenc: Reconstify mjpeg encoder
It has been deconstified in 2c2dfd914902d0b41b4bd30d4b19ae08af1d7bc1
because the FFCodec is touched in av_codec_init_static because
of its get_supported_config callback. Yet this is easily remedied:
Only call get_supported_config to set pix_fmts if the codec does
not already have it set.
This also fixes a mismatch between the declaration of ff_mjpeg_encoder
in allcodecs.c and the definition in mjpegenc.c. Said mismatch is
actually undefined behaviour.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/allcodecs.c | 9 +++++----
libavcodec/mjpegenc.c | 2 +-
2 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index 8605793c8f..de28863f1f 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -937,10 +937,11 @@ static void av_codec_init_static(void)
FF_DISABLE_DEPRECATION_WARNINGS
switch (codec->p.type) {
case AVMEDIA_TYPE_VIDEO:
- codec->get_supported_config(NULL, &codec->p,
- AV_CODEC_CONFIG_PIX_FORMAT, 0,
- (const void **) &codec->p.pix_fmts,
- &dummy);
+ 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,
diff --git a/libavcodec/mjpegenc.c b/libavcodec/mjpegenc.c
index 3ac1010e4f..30f2c9900d 100644
--- a/libavcodec/mjpegenc.c
+++ b/libavcodec/mjpegenc.c
@@ -675,7 +675,7 @@ static int mjpeg_get_supported_config(const AVCodecContext *avctx,
return ff_default_get_supported_config(avctx, codec, config, flags, out, out_num);
}
-FFCodec ff_mjpeg_encoder = {
+const FFCodec ff_mjpeg_encoder = {
.p.name = "mjpeg",
CODEC_LONG_NAME("MJPEG (Motion JPEG)"),
.p.type = AVMEDIA_TYPE_VIDEO,
--
2.45.2
[-- Attachment #5: Type: text/plain, Size: 251 bytes --]
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2025-03-10 3:31 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-03-10 3:31 [FFmpeg-devel] [PATCH 1/3] avcodec/tests/avcodec: Silence deprecation warnings Andreas Rheinhardt
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git