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


>From 108585400e1f0a7f0326541d9edf5c49bd520ea5 Mon Sep 17 00:00:00 2001
From: yongdev <[email protected]>
Date: Wed, 1 Apr 2026 11:01:39 -0700
Subject: [PATCH] Fix libavcodec enum forward delcaration for cpp

---
 libavcodec/avcodec.h        | 11 -----------
 libavcodec/codec_internal.h |  2 +-
 libavcodec/decode.h         |  3 +--
 libavcodec/defs.h           | 27 +++++++++++++++++++++++++++
 libavcodec/exif.h           | 16 ----------------
 5 files changed, 29 insertions(+), 30 deletions(-)

diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 1a8f77af82..bf937c9a67 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -2541,17 +2541,6 @@ int avcodec_get_hw_frames_parameters(AVCodecContext 
*avctx,
                                      enum AVPixelFormat hw_pix_fmt,
                                      AVBufferRef **out_frames_ref);
 
-enum AVCodecConfig {
-    AV_CODEC_CONFIG_PIX_FORMAT,     ///< AVPixelFormat, terminated by 
AV_PIX_FMT_NONE
-    AV_CODEC_CONFIG_FRAME_RATE,     ///< AVRational, terminated by {0, 0}
-    AV_CODEC_CONFIG_SAMPLE_RATE,    ///< int, terminated by 0
-    AV_CODEC_CONFIG_SAMPLE_FORMAT,  ///< AVSampleFormat, terminated by 
AV_SAMPLE_FMT_NONE
-    AV_CODEC_CONFIG_CHANNEL_LAYOUT, ///< AVChannelLayout, terminated by {0}
-    AV_CODEC_CONFIG_COLOR_RANGE,    ///< AVColorRange, terminated by 
AVCOL_RANGE_UNSPECIFIED
-    AV_CODEC_CONFIG_COLOR_SPACE,    ///< AVColorSpace, terminated by 
AVCOL_SPC_UNSPECIFIED
-    AV_CODEC_CONFIG_ALPHA_MODE,     ///< AVAlphaMode, terminated by 
AVALPHA_MODE_UNSPECIFIED
-};
-
 /**
  * Retrieve a list of all supported values for a given configuration type.
  *
diff --git a/libavcodec/codec_internal.h b/libavcodec/codec_internal.h
index eea982e56c..86d6fd6f0a 100644
--- a/libavcodec/codec_internal.h
+++ b/libavcodec/codec_internal.h
@@ -23,6 +23,7 @@
 
 #include "libavutil/attributes.h"
 #include "codec.h"
+#include "defs.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;
diff --git a/libavcodec/decode.h b/libavcodec/decode.h
index 561dc6a69c..fe9223a9de 100644
--- a/libavcodec/decode.h
+++ b/libavcodec/decode.h
@@ -25,6 +25,7 @@
 #include "libavutil/hwcontext.h"
 
 #include "avcodec.h"
+#include "defs.h"
 
 /**
  * This struct stores per-frame lavc-internal data and is attached to it via
@@ -221,8 +222,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
diff --git a/libavcodec/defs.h b/libavcodec/defs.h
index b13e983b13..398c573516 100644
--- a/libavcodec/defs.h
+++ b/libavcodec/defs.h
@@ -245,6 +245,33 @@ enum AVAudioServiceType {
     AV_AUDIO_SERVICE_TYPE_NB                   , ///< Not part of ABI
 };
 
+enum AVCodecConfig {
+    AV_CODEC_CONFIG_PIX_FORMAT,     ///< AVPixelFormat, terminated by 
AV_PIX_FMT_NONE
+    AV_CODEC_CONFIG_FRAME_RATE,     ///< AVRational, terminated by {0, 0}
+    AV_CODEC_CONFIG_SAMPLE_RATE,    ///< int, terminated by 0
+    AV_CODEC_CONFIG_SAMPLE_FORMAT,  ///< AVSampleFormat, terminated by 
AV_SAMPLE_FMT_NONE
+    AV_CODEC_CONFIG_CHANNEL_LAYOUT, ///< AVChannelLayout, terminated by {0}
+    AV_CODEC_CONFIG_COLOR_RANGE,    ///< AVColorRange, terminated by 
AVCOL_RANGE_UNSPECIFIED
+    AV_CODEC_CONFIG_COLOR_SPACE,    ///< AVColorSpace, terminated by 
AVCOL_SPC_UNSPECIFIED
+    AV_CODEC_CONFIG_ALPHA_MODE,     ///< AVAlphaMode, terminated by 
AVALPHA_MODE_UNSPECIFIED
+};
+
+enum AVExifHeaderMode {
+    /**
+     * The TIFF header starts with 0x49492a00, or 0x4d4d002a.
+     * This one is used internally by FFmpeg.
+     */
+    AV_EXIF_TIFF_HEADER,
+    /** skip the TIFF header, assume little endian */
+    AV_EXIF_ASSUME_LE,
+    /** skip the TIFF header, assume big endian */
+    AV_EXIF_ASSUME_BE,
+    /** The first four bytes point to the actual start, then it's 
AV_EXIF_TIFF_HEADER */
+    AV_EXIF_T_OFF,
+    /** The first six bytes contain "Exif\0\0", then it's AV_EXIF_TIFF_HEADER 
*/
+    AV_EXIF_EXIF00,
+};
+
 /**
  * Pan Scan area.
  * This specifies the area which should be displayed.
diff --git a/libavcodec/exif.h b/libavcodec/exif.h
index 1824a38d1c..d3b8625fce 100644
--- a/libavcodec/exif.h
+++ b/libavcodec/exif.h
@@ -55,22 +55,6 @@ enum AVTiffDataType {
     AV_TIFF_IFD,
 };
 
-enum AVExifHeaderMode {
-    /**
-     * The TIFF header starts with 0x49492a00, or 0x4d4d002a.
-     * This one is used internally by FFmpeg.
-     */
-    AV_EXIF_TIFF_HEADER,
-    /** skip the TIFF header, assume little endian */
-    AV_EXIF_ASSUME_LE,
-    /** skip the TIFF header, assume big endian */
-    AV_EXIF_ASSUME_BE,
-    /** The first four bytes point to the actual start, then it's 
AV_EXIF_TIFF_HEADER */
-    AV_EXIF_T_OFF,
-    /** The first six bytes contain "Exif\0\0", then it's AV_EXIF_TIFF_HEADER 
*/
-    AV_EXIF_EXIF00,
-};
-
 typedef struct AVExifEntry AVExifEntry;
 
 typedef struct AVExifMetadata {
-- 
2.52.0

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

Reply via email to