PR #22739 opened by mkver URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/22739 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/22739.patch
Alternative to #22684. >From 592c8b1ab5fed16c7b1c8f26448289cc8f4f0733 Mon Sep 17 00:00:00 2001 From: Andreas Rheinhardt <[email protected]> Date: Tue, 7 Apr 2026 14:52:02 +0200 Subject: [PATCH 1/2] avcodec/codec_internal: Include avcodec.h for enum AVCodecConfig Forward-declaring an enum is not legal C (the underlying type of the enum may depend upon the enum constants, so this may cause ABI issues with -fshort-enums); compilers warn about this with -pedantic. This essentially reverts 7e84865cff2d174beede69a2018c0d81c8cc3b02. Notice that almost* all files that include codec_internal.h also need to include avcodec.h, so this does not lead to unnecessary rebuilds. This addresses part of #22684. *: The only file I am aware of that defines an FFCodec and does not need AVCodecContext as complete type is null.c (but even it already includes it implicitly); the avcodec.c test tool seems to be the only file where this commit actually leads to an unnecessary avcodec.h inclusion. Signed-off-by: Andreas Rheinhardt <[email protected]> --- libavcodec/codec_internal.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/codec_internal.h b/libavcodec/codec_internal.h index eea982e56c..720788210d 100644 --- a/libavcodec/codec_internal.h +++ b/libavcodec/codec_internal.h @@ -22,6 +22,7 @@ #include <stdint.h> #include "libavutil/attributes.h" +#include "avcodec.h" #include "codec.h" #include "config.h" @@ -101,7 +102,6 @@ typedef struct FFCodecDefault { struct AVCodecContext; struct AVSubtitle; struct AVPacket; -enum AVCodecConfig; enum FFCodecType { /* The codec is a decoder using the decode callback; -- 2.52.0 >From 66c7c9a98d98cd938f5d7b69ba96184bb17e52b7 Mon Sep 17 00:00:00 2001 From: Andreas Rheinhardt <[email protected]> Date: Tue, 7 Apr 2026 15:06:30 +0200 Subject: [PATCH 2/2] avcodec/decode: Don't forward declare enum AVExifHeaderMode Forward-declaring an enum is not legal C (the underlying type of the enum may depend upon the enum constants, so this may cause ABI issues with -fshort-enums); compilers warn about this with -pedantic. Yet decode.h does it for enum AVExifHeaderMode. Given that almost no one actually needs ff_decode_exif_attach_buffer(), including exif.h would lead to an unnecessary inclusion for many lavc files. Just use an int to avoid this. Signed-off-by: Andreas Rheinhardt <[email protected]> --- libavcodec/decode.c | 2 +- libavcodec/decode.h | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/libavcodec/decode.c b/libavcodec/decode.c index 206b711390..ad21c38e50 100644 --- a/libavcodec/decode.c +++ b/libavcodec/decode.c @@ -2469,7 +2469,7 @@ int ff_decode_exif_attach_ifd(AVCodecContext *avctx, AVFrame *frame, const AVExi } int ff_decode_exif_attach_buffer(AVCodecContext *avctx, AVFrame *frame, AVBufferRef **pbuf, - enum AVExifHeaderMode header_mode) + int /*enum AVExifHeaderMode*/ header_mode) { int ret; AVBufferRef *data = *pbuf; diff --git a/libavcodec/decode.h b/libavcodec/decode.h index 5a7ab64c29..3ee8e5f2a3 100644 --- a/libavcodec/decode.h +++ b/libavcodec/decode.h @@ -227,8 +227,6 @@ int ff_decode_content_light_new_ext(const AVCodecContext *avctx, AVFrameSideData ***sd, int *nb_sd, struct AVContentLightMetadata **clm); -enum AVExifHeaderMode; - /** * Attach the data buffer to the frame. This is mostly a wrapper for * av_side_data_new_from_buffer, but it checks if the orientation tag is @@ -240,7 +238,7 @@ enum AVExifHeaderMode; * on failure. */ int ff_decode_exif_attach_buffer(AVCodecContext *avctx, AVFrame *frame, AVBufferRef **buf, - enum AVExifHeaderMode header_mode); + int /*enum AVExifHeaderMode*/ header_mode); struct AVExifMetadata; -- 2.52.0 _______________________________________________ ffmpeg-devel mailing list -- [email protected] To unsubscribe send an email to [email protected]
