PR #23336 opened by mkver
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/23336
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/23336.patch

Intended to supersede #22684 and #22739.


>From 789ed785569202f5850859e9fc3ca28f3927a453 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <[email protected]>
Date: Thu, 4 Jun 2026 18:14:20 +0200
Subject: [PATCH 1/2] avcodec/decode: Move exif declarations to exif_internal.h

It is (arguably) a slightly better place for them and avoids
a forward declaration of enum AVExifHeaderMode which is not possible
in ISO C before C23 (and requires specifying the underlying type
with C23).

Signed-off-by: Andreas Rheinhardt <[email protected]>
---
 libavcodec/decode.c        |  1 +
 libavcodec/decode.h        | 29 -----------------------------
 libavcodec/exif_internal.h | 26 ++++++++++++++++++++++++++
 libavcodec/mjpegdec.c      |  1 +
 4 files changed, 28 insertions(+), 29 deletions(-)

diff --git a/libavcodec/decode.c b/libavcodec/decode.c
index c82e357845..81659435a0 100644
--- a/libavcodec/decode.c
+++ b/libavcodec/decode.c
@@ -49,6 +49,7 @@
 #include "codec_internal.h"
 #include "decode.h"
 #include "exif.h"
+#include "exif_internal.h"
 #include "hwaccel_internal.h"
 #include "hwconfig.h"
 #include "internal.h"
diff --git a/libavcodec/decode.h b/libavcodec/decode.h
index 536c71f3e4..215b862020 100644
--- a/libavcodec/decode.h
+++ b/libavcodec/decode.h
@@ -230,33 +230,4 @@ 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
- * present in the provided EXIF buffer. If it is, it zeroes it out and
- * attaches that information as an AV_FRAME_DATA_DISPLAYMATRIX instead
- * of including it in the AV_FRAME_DATA_EXIF side data buffer.
- *
- * *buf is ALWAYS consumed by this function and NULL written in its place, even
- * on failure.
- */
-int ff_decode_exif_attach_buffer(AVCodecContext *avctx, AVFrame *frame, 
AVBufferRef **buf,
-                                 enum AVExifHeaderMode header_mode);
-
-struct AVExifMetadata;
-
-/**
- * Attach an already-parsed EXIF metadata struct to the frame as a side data
- * buffer. It writes the EXIF IFD into the buffer and attaches the buffer to
- * the frame.
- *
- * If the metadata struct contains an orientation tag, it will be zeroed before
- * writing, and instead, an AV_FRAME_DATA_DISPLAYMATRIX will be attached in
- * addition to the AV_FRAME_DATA_EXIF side data.
- */
-int ff_decode_exif_attach_ifd(AVCodecContext *avctx, AVFrame *frame,
-                              const struct AVExifMetadata *ifd);
-
 #endif /* AVCODEC_DECODE_H */
diff --git a/libavcodec/exif_internal.h b/libavcodec/exif_internal.h
index 713b84ef62..7fd593ce81 100644
--- a/libavcodec/exif_internal.h
+++ b/libavcodec/exif_internal.h
@@ -65,4 +65,30 @@ int ff_exif_sanitize_ifd(void *logctx, const AVFrame *frame, 
AVExifMetadata *ifd
  */
 int ff_exif_get_buffer(void *logctx, const AVFrame *frame, AVBufferRef 
**buffer, enum AVExifHeaderMode header_mode);
 
+struct AVCodecContext;
+/**
+ * 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
+ * present in the provided EXIF buffer. If it is, it zeroes it out and
+ * attaches that information as an AV_FRAME_DATA_DISPLAYMATRIX instead
+ * of including it in the AV_FRAME_DATA_EXIF side data buffer.
+ *
+ * *buf is ALWAYS consumed by this function and NULL written in its place, even
+ * on failure.
+ */
+int ff_decode_exif_attach_buffer(struct AVCodecContext *avctx, AVFrame *frame, 
AVBufferRef **buf,
+                                 enum AVExifHeaderMode header_mode);
+
+/**
+ * Attach an already-parsed EXIF metadata struct to the frame as a side data
+ * buffer. It writes the EXIF IFD into the buffer and attaches the buffer to
+ * the frame.
+ *
+ * If the metadata struct contains an orientation tag, it will be zeroed before
+ * writing, and instead, an AV_FRAME_DATA_DISPLAYMATRIX will be attached in
+ * addition to the AV_FRAME_DATA_EXIF side data.
+ */
+int ff_decode_exif_attach_ifd(struct AVCodecContext *avctx, AVFrame *frame,
+                              const struct AVExifMetadata *ifd);
+
 #endif /* AVCODEC_EXIF_INTERNAL_H */
diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
index e6c4f4acfc..d72646206b 100644
--- a/libavcodec/mjpegdec.c
+++ b/libavcodec/mjpegdec.c
@@ -43,6 +43,7 @@
 #include "copy_block.h"
 #include "decode.h"
 #include "exif.h"
+#include "exif_internal.h"
 #include "hwaccel_internal.h"
 #include "hwconfig.h"
 #include "idctdsp.h"
-- 
2.52.0


>From 5c3f94e6a576b6ce5f38d866ab4eb02b4632182c Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <[email protected]>
Date: Thu, 4 Jun 2026 18:30:02 +0200
Subject: [PATCH 2/2] avcodec/exif: Remove version_major.h inclusion

Forgotten in d151d3aecbe2a478c44be7faca56caae1848ca87.

Signed-off-by: Andreas Rheinhardt <[email protected]>
---
 libavcodec/exif.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/libavcodec/exif.h b/libavcodec/exif.h
index a19ba6925d..a230833687 100644
--- a/libavcodec/exif.h
+++ b/libavcodec/exif.h
@@ -36,7 +36,6 @@
 #include "libavutil/buffer.h"
 #include "libavutil/dict.h"
 #include "libavutil/rational.h"
-#include "version_major.h"
 
 /** Data type identifiers for TIFF tags */
 enum AVTiffDataType {
-- 
2.52.0

_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to