diff mbox series

[FFmpeg-devel] Keep including the full version.h when headers are included externally

Message ID 20220318081521.60218-1-martin@martin.st
State Accepted
Commit 2d368392a5d6b856d63959ae8bfd40dd598c27e7
Headers show
Series [FFmpeg-devel] Keep including the full version.h when headers are included externally | expand

Checks

Context Check Description
yinshiyou/commit_msg_loongarch64 warning The first line of the commit message must start with a context terminated by a colon and a space, for example "lavu/opt: " or "doc: ".
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/commit_msg_aarch64_jetson warning The first line of the commit message must start with a context terminated by a colon and a space, for example "lavu/opt: " or "doc: ".
andriy/make_aarch64_jetson success Make finished
andriy/make_fate_aarch64_jetson success Make fate finished
andriy/commit_msg_armv7_RPi4 warning The first line of the commit message must start with a context terminated by a colon and a space, for example "lavu/opt: " or "doc: ".
andriy/make_armv7_RPi4 success Make finished
andriy/make_fate_armv7_RPi4 success Make fate finished

Commit Message

Martin Storsjö March 18, 2022, 8:15 a.m. UTC
This avoids unnecessary churn and build breakage for users, by
making sure the whole version.h is included like it has been so far,
while keeping the benefit of not needing to rebuild most files in
the ffmpeg tree on minor/micro bumps.
---
Surprisingly many downstream users do seem to rely on the version
defines.
---
 doc/APIchanges             | 9 ++-------
 libavcodec/avcodec.h       | 6 ++++++
 libavdevice/avdevice.h     | 6 ++++++
 libavfilter/avfilter.h     | 6 ++++++
 libavformat/avformat.h     | 6 ++++++
 libpostproc/postprocess.h  | 6 ++++++
 libswresample/swresample.h | 6 ++++++
 libswscale/swscale.h       | 6 ++++++
 8 files changed, 44 insertions(+), 7 deletions(-)

Comments

Martin Storsjö March 18, 2022, 10:13 p.m. UTC | #1
On Fri, 18 Mar 2022, Martin Storsjö wrote:

> This avoids unnecessary churn and build breakage for users, by
> making sure the whole version.h is included like it has been so far,
> while keeping the benefit of not needing to rebuild most files in
> the ffmpeg tree on minor/micro bumps.
> ---
> Surprisingly many downstream users do seem to rely on the version
> defines.
> ---
> doc/APIchanges             | 9 ++-------
> libavcodec/avcodec.h       | 6 ++++++
> libavdevice/avdevice.h     | 6 ++++++
> libavfilter/avfilter.h     | 6 ++++++
> libavformat/avformat.h     | 6 ++++++
> libpostproc/postprocess.h  | 6 ++++++
> libswresample/swresample.h | 6 ++++++
> libswscale/swscale.h       | 6 ++++++
> 8 files changed, 44 insertions(+), 7 deletions(-)

I'll go ahead and push this; Andreas wasn't against it, and it avoids 
unnecessary downstream breakage.

// Martin
diff mbox series

Patch

diff --git a/doc/APIchanges b/doc/APIchanges
index 7b324f48fa..41662da84f 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -14,15 +14,10 @@  libavutil:     2021-04-27
 
 API changes, most recent first:
 
-2022-03-16 - xxxxxxxxxx - all libraries - version.h, version_major.h
-  No longer implicitly include lib<name>/version.h in lib<name>/<name>.h.
-  Users who depend on defines from these files (LIB<name>_VERSION*,
-  LIB<name>_IDENT) must explicitly include these headers instead of
-  relying on them being included implicitly.
+2022-03-16 - xxxxxxxxxx - all libraries - version_major.h
   Add lib<name>/version_major.h as new installed headers, which only
   contain the major version number (and corresponding API deprecation
-  defines). These headers are still implicitly included from the
-  library main headers.
+  defines).
 
 2022-03-10 - xxxxxxxxxx - lavu 57.23.100 - cpu.h
   Add AV_CPU_FLAG_AVX512ICL.
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index c6512f12c4..4dae23d06e 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -44,6 +44,12 @@ 
 #include "defs.h"
 #include "packet.h"
 #include "version_major.h"
+#ifndef HAVE_AV_CONFIG_H
+/* When included as part of the ffmpeg build, only include the major version
+ * to avoid unnecessary rebuilds. When included externally, keep including
+ * the full version information. */
+#include "version.h"
+#endif
 
 /**
  * @defgroup libavc libavcodec
diff --git a/libavdevice/avdevice.h b/libavdevice/avdevice.h
index 6de0e33819..0b32e59fed 100644
--- a/libavdevice/avdevice.h
+++ b/libavdevice/avdevice.h
@@ -20,6 +20,12 @@ 
 #define AVDEVICE_AVDEVICE_H
 
 #include "version_major.h"
+#ifndef HAVE_AV_CONFIG_H
+/* When included as part of the ffmpeg build, only include the major version
+ * to avoid unnecessary rebuilds. When included externally, keep including
+ * the full version information. */
+#include "version.h"
+#endif
 
 /**
  * @file
diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h
index 3fb41d777c..2e8197c9a6 100644
--- a/libavfilter/avfilter.h
+++ b/libavfilter/avfilter.h
@@ -48,6 +48,12 @@ 
 #include "libavutil/rational.h"
 
 #include "libavfilter/version_major.h"
+#ifndef HAVE_AV_CONFIG_H
+/* When included as part of the ffmpeg build, only include the major version
+ * to avoid unnecessary rebuilds. When included externally, keep including
+ * the full version information. */
+#include "libavfilter/version.h"
+#endif
 
 /**
  * Return the LIBAVFILTER_VERSION_INT constant.
diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index 03df76af92..f12fa7d904 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -320,6 +320,12 @@ 
 
 #include "avio.h"
 #include "libavformat/version_major.h"
+#ifndef HAVE_AV_CONFIG_H
+/* When included as part of the ffmpeg build, only include the major version
+ * to avoid unnecessary rebuilds. When included externally, keep including
+ * the full version information. */
+#include "libavformat/version.h"
+#endif
 
 struct AVFormatContext;
 struct AVStream;
diff --git a/libpostproc/postprocess.h b/libpostproc/postprocess.h
index cf4e78c83a..5decb7e8a9 100644
--- a/libpostproc/postprocess.h
+++ b/libpostproc/postprocess.h
@@ -35,6 +35,12 @@ 
  */
 
 #include "libpostproc/version_major.h"
+#ifndef HAVE_AV_CONFIG_H
+/* When included as part of the ffmpeg build, only include the major version
+ * to avoid unnecessary rebuilds. When included externally, keep including
+ * the full version information. */
+#include "libpostproc/version.h"
+#endif
 
 /**
  * Return the LIBPOSTPROC_VERSION_INT constant.
diff --git a/libswresample/swresample.h b/libswresample/swresample.h
index 2c4eb3562d..26d42fab8d 100644
--- a/libswresample/swresample.h
+++ b/libswresample/swresample.h
@@ -126,6 +126,12 @@ 
 #include "libavutil/samplefmt.h"
 
 #include "libswresample/version_major.h"
+#ifndef HAVE_AV_CONFIG_H
+/* When included as part of the ffmpeg build, only include the major version
+ * to avoid unnecessary rebuilds. When included externally, keep including
+ * the full version information. */
+#include "libswresample/version.h"
+#endif
 
 /**
  * @name Option constants
diff --git a/libswscale/swscale.h b/libswscale/swscale.h
index 07c69e1ae7..3ebf7c698d 100644
--- a/libswscale/swscale.h
+++ b/libswscale/swscale.h
@@ -34,6 +34,12 @@ 
 #include "libavutil/log.h"
 #include "libavutil/pixfmt.h"
 #include "version_major.h"
+#ifndef HAVE_AV_CONFIG_H
+/* When included as part of the ffmpeg build, only include the major version
+ * to avoid unnecessary rebuilds. When included externally, keep including
+ * the full version information. */
+#include "version.h"
+#endif
 
 /**
  * @defgroup libsws libswscale