[FFmpeg-devel] [PATCH] */version.h: define FF_API macros unconditionally

Anton Khirnov anton at khirnov.net
Fri Nov 12 15:34:56 EET 2021


There is no reason to wrap them in #ifndef guards, they should only be
defined here and nowhere else. The define guards just add the
possibility to accidentally use the same FF_API name in different
libraries.
---
 libavcodec/version.h  | 24 ------------------------
 libavdevice/version.h |  2 --
 libavfilter/version.h |  6 ------
 libavformat/version.h |  8 --------
 libavutil/version.h   |  8 --------
 5 files changed, 48 deletions(-)

diff --git a/libavcodec/version.h b/libavcodec/version.h
index 74b8baa5f3..7d4cfa3f11 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -51,41 +51,17 @@
  * at once through the bump. This improves the git bisect-ability of the change.
  */
 
-#ifndef FF_API_OPENH264_SLICE_MODE
 #define FF_API_OPENH264_SLICE_MODE (LIBAVCODEC_VERSION_MAJOR < 60)
-#endif
-#ifndef FF_API_OPENH264_CABAC
 #define FF_API_OPENH264_CABAC      (LIBAVCODEC_VERSION_MAJOR < 60)
-#endif
-#ifndef FF_API_UNUSED_CODEC_CAPS
 #define FF_API_UNUSED_CODEC_CAPS   (LIBAVCODEC_VERSION_MAJOR < 60)
-#endif
-#ifndef FF_API_THREAD_SAFE_CALLBACKS
 #define FF_API_THREAD_SAFE_CALLBACKS (LIBAVCODEC_VERSION_MAJOR < 60)
-#endif
-#ifndef FF_API_DEBUG_MV
 #define FF_API_DEBUG_MV          (LIBAVCODEC_VERSION_MAJOR < 60)
-#endif
-#ifndef FF_API_GET_FRAME_CLASS
 #define FF_API_GET_FRAME_CLASS     (LIBAVCODEC_VERSION_MAJOR < 60)
-#endif
-#ifndef FF_API_AUTO_THREADS
 #define FF_API_AUTO_THREADS        (LIBAVCODEC_VERSION_MAJOR < 60)
-#endif
-#ifndef FF_API_INIT_PACKET
 #define FF_API_INIT_PACKET         (LIBAVCODEC_VERSION_MAJOR < 60)
-#endif
-#ifndef FF_API_AVCTX_TIMEBASE
 #define FF_API_AVCTX_TIMEBASE    (LIBAVCODEC_VERSION_MAJOR < 60)
-#endif
-#ifndef FF_API_MPEGVIDEO_OPTS
 #define FF_API_MPEGVIDEO_OPTS      (LIBAVCODEC_VERSION_MAJOR < 60)
-#endif
-#ifndef FF_API_FLAG_TRUNCATED
 #define FF_API_FLAG_TRUNCATED      (LIBAVCODEC_VERSION_MAJOR < 60)
-#endif
-#ifndef FF_API_SUB_TEXT_FORMAT
 #define FF_API_SUB_TEXT_FORMAT     (LIBAVCODEC_VERSION_MAJOR < 60)
-#endif
 
 #endif /* AVCODEC_VERSION_H */
diff --git a/libavdevice/version.h b/libavdevice/version.h
index 8daeb0059a..914e156ec7 100644
--- a/libavdevice/version.h
+++ b/libavdevice/version.h
@@ -46,8 +46,6 @@
  * dropped at a future version bump. The defines themselves are not part of
  * the public API and may change, break or disappear at any time.
  */
-#ifndef FF_API_DEVICE_CAPABILITIES
 #define FF_API_DEVICE_CAPABILITIES (LIBAVDEVICE_VERSION_MAJOR < 60)
-#endif
 
 #endif /* AVDEVICE_VERSION_H */
diff --git a/libavfilter/version.h b/libavfilter/version.h
index 3bd3816698..24a180d818 100644
--- a/libavfilter/version.h
+++ b/libavfilter/version.h
@@ -50,14 +50,8 @@
  * the public API and may change, break or disappear at any time.
  */
 
-#ifndef FF_API_SWS_PARAM_OPTION
 #define FF_API_SWS_PARAM_OPTION             (LIBAVFILTER_VERSION_MAJOR < 9)
-#endif
-#ifndef FF_API_BUFFERSINK_ALLOC
 #define FF_API_BUFFERSINK_ALLOC             (LIBAVFILTER_VERSION_MAJOR < 9)
-#endif
-#ifndef FF_API_PAD_COUNT
 #define FF_API_PAD_COUNT                    (LIBAVFILTER_VERSION_MAJOR < 9)
-#endif
 
 #endif /* AVFILTER_VERSION_H */
diff --git a/libavformat/version.h b/libavformat/version.h
index 81ed517609..2e860b8d76 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -55,18 +55,10 @@
  * at once through the bump. This improves the git bisect-ability of the change.
  *
  */
-#ifndef FF_API_LAVF_PRIV_OPT
 #define FF_API_LAVF_PRIV_OPT            (LIBAVFORMAT_VERSION_MAJOR < 60)
-#endif
-#ifndef FF_API_COMPUTE_PKT_FIELDS2
 #define FF_API_COMPUTE_PKT_FIELDS2      (LIBAVFORMAT_VERSION_MAJOR < 60)
-#endif
-#ifndef FF_API_AVIOCONTEXT_WRITTEN
 #define FF_API_AVIOCONTEXT_WRITTEN      (LIBAVFORMAT_VERSION_MAJOR < 60)
-#endif
 
 
-#ifndef FF_API_R_FRAME_RATE
 #define FF_API_R_FRAME_RATE            1
-#endif
 #endif /* AVFORMAT_VERSION_H */
diff --git a/libavutil/version.h b/libavutil/version.h
index eeb33b388c..5ebef06829 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -105,18 +105,10 @@
  * @{
  */
 
-#ifndef FF_API_D2STR
 #define FF_API_D2STR                    (LIBAVUTIL_VERSION_MAJOR < 58)
-#endif
-#ifndef FF_API_DECLARE_ALIGNED
 #define FF_API_DECLARE_ALIGNED          (LIBAVUTIL_VERSION_MAJOR < 58)
-#endif
-#ifndef FF_API_COLORSPACE_NAME
 #define FF_API_COLORSPACE_NAME          (LIBAVUTIL_VERSION_MAJOR < 58)
-#endif
-#ifndef FF_API_AV_MALLOCZ_ARRAY
 #define FF_API_AV_MALLOCZ_ARRAY         (LIBAVUTIL_VERSION_MAJOR < 58)
-#endif
 
 /**
  * @}
-- 
2.33.0



More information about the ffmpeg-devel mailing list