Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
To: ffmpeg-devel@ffmpeg.org
Cc: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Subject: [FFmpeg-devel] [PATCH 3/3] avcodec/avcodec: Avoid codec_desc.h, codec_par.h inclusions
Date: Tue, 26 Sep 2023 01:55:26 +0200
Message-ID: <AS8P250MB0744066117E5D57BE8A09C3C8FFCA@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <AS8P250MB0744A326D1AFE52E275B92678FFCA@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM>

Instead, use forward declarations; and in order not to affect
any user include these headers for them, but not internally.
This has the advantage of removing implicit inclusions of these
headers from almost all files providing codecs.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/avcodec.c          |  1 +
 libavcodec/avcodec.h          | 14 +++++++++-----
 libavcodec/decode.c           |  1 +
 libavcodec/encode.c           |  1 +
 libavcodec/nvenc.c            |  1 +
 libavcodec/tests/codec_desc.c |  2 +-
 libavcodec/utils.c            |  2 ++
 libavcodec/vaapi_decode.c     |  1 +
 libavfilter/vf_subtitles.c    |  1 +
 9 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/libavcodec/avcodec.c b/libavcodec/avcodec.c
index 131834b6de..f2dc7b0edd 100644
--- a/libavcodec/avcodec.c
+++ b/libavcodec/avcodec.c
@@ -37,6 +37,7 @@
 #include "avcodec.h"
 #include "avcodec_internal.h"
 #include "bsf.h"
+#include "codec_desc.h"
 #include "codec_internal.h"
 #include "decode.h"
 #include "encode.h"
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index da3c5234a0..09400b97b0 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -31,6 +31,7 @@
 #include "libavutil/attributes.h"
 #include "libavutil/avutil.h"
 #include "libavutil/buffer.h"
+#include "libavutil/channel_layout.h"
 #include "libavutil/dict.h"
 #include "libavutil/frame.h"
 #include "libavutil/log.h"
@@ -38,8 +39,6 @@
 #include "libavutil/rational.h"
 
 #include "codec.h"
-#include "codec_desc.h"
-#include "codec_par.h"
 #include "codec_id.h"
 #include "defs.h"
 #include "packet.h"
@@ -49,8 +48,13 @@
  * to avoid unnecessary rebuilds. When included externally, keep including
  * the full version information. */
 #include "version.h"
+
+#include "codec_desc.h"
+#include "codec_par.h"
 #endif
 
+struct AVCodecParameters;
+
 /**
  * @defgroup libavc libavcodec
  * Encoding/Decoding Library
@@ -1815,7 +1819,7 @@ typedef struct AVCodecContext {
      * - encoding: unused.
      * - decoding: set by libavcodec.
      */
-    const AVCodecDescriptor *codec_descriptor;
+    const struct AVCodecDescriptor *codec_descriptor;
 
     /**
      * Current statistics for PTS correction.
@@ -2328,7 +2332,7 @@ const AVClass *avcodec_get_subtitle_rect_class(void);
  *
  * @return >= 0 on success, a negative AVERROR code on failure
  */
-int avcodec_parameters_from_context(AVCodecParameters *par,
+int avcodec_parameters_from_context(struct AVCodecParameters *par,
                                     const AVCodecContext *codec);
 
 /**
@@ -2340,7 +2344,7 @@ int avcodec_parameters_from_context(AVCodecParameters *par,
  * @return >= 0 on success, a negative AVERROR code on failure.
  */
 int avcodec_parameters_to_context(AVCodecContext *codec,
-                                  const AVCodecParameters *par);
+                                  const struct AVCodecParameters *par);
 
 /**
  * Initialize the AVCodecContext to use the given AVCodec. Prior to using this
diff --git a/libavcodec/decode.c b/libavcodec/decode.c
index 466c393c1e..9b23a6717c 100644
--- a/libavcodec/decode.c
+++ b/libavcodec/decode.c
@@ -45,6 +45,7 @@
 #include "avcodec_internal.h"
 #include "bytestream.h"
 #include "bsf.h"
+#include "codec_desc.h"
 #include "codec_internal.h"
 #include "decode.h"
 #include "hwaccel_internal.h"
diff --git a/libavcodec/encode.c b/libavcodec/encode.c
index 7cd3213b73..a436be2657 100644
--- a/libavcodec/encode.c
+++ b/libavcodec/encode.c
@@ -30,6 +30,7 @@
 
 #include "avcodec.h"
 #include "avcodec_internal.h"
+#include "codec_desc.h"
 #include "codec_internal.h"
 #include "encode.h"
 #include "frame_thread_encoder.h"
diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c
index 65b96d6cf6..02486c2043 100644
--- a/libavcodec/nvenc.c
+++ b/libavcodec/nvenc.c
@@ -36,6 +36,7 @@
 #include "libavutil/pixdesc.h"
 #include "libavutil/mathematics.h"
 #include "atsc_a53.h"
+#include "codec_desc.h"
 #include "encode.h"
 #include "internal.h"
 #include "packet_internal.h"
diff --git a/libavcodec/tests/codec_desc.c b/libavcodec/tests/codec_desc.c
index c9b3497343..bceb91a32a 100644
--- a/libavcodec/tests/codec_desc.c
+++ b/libavcodec/tests/codec_desc.c
@@ -16,7 +16,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
-#include "libavcodec/avcodec.h"
+#include "libavcodec/codec_desc.h"
 
 int main(int argc, char **argv)
 {
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 3cb3828228..8807a8c2b6 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -35,7 +35,9 @@
 #include "libavutil/pixfmt.h"
 #include "avcodec.h"
 #include "codec.h"
+#include "codec_desc.h"
 #include "codec_internal.h"
+#include "codec_par.h"
 #include "decode.h"
 #include "hwconfig.h"
 #include "thread.h"
diff --git a/libavcodec/vaapi_decode.c b/libavcodec/vaapi_decode.c
index 10b4284db0..ceac769c52 100644
--- a/libavcodec/vaapi_decode.c
+++ b/libavcodec/vaapi_decode.c
@@ -23,6 +23,7 @@
 #include "libavutil/pixdesc.h"
 
 #include "avcodec.h"
+#include "codec_desc.h"
 #include "decode.h"
 #include "internal.h"
 #include "vaapi_decode.h"
diff --git a/libavfilter/vf_subtitles.c b/libavfilter/vf_subtitles.c
index e2857e90c0..ef5f9cd866 100644
--- a/libavfilter/vf_subtitles.c
+++ b/libavfilter/vf_subtitles.c
@@ -33,6 +33,7 @@
 #include "config_components.h"
 #if CONFIG_SUBTITLES_FILTER
 # include "libavcodec/avcodec.h"
+# include "libavcodec/codec_desc.h"
 # include "libavformat/avformat.h"
 #endif
 #include "libavutil/avstring.h"
-- 
2.34.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

  parent reply	other threads:[~2023-09-25 23:54 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-25 23:54 [FFmpeg-devel] [PATCH v2 1/3] avformat/avformat: Deprecate AVFMT_ALLOW_FLUSH Andreas Rheinhardt
2023-09-25 23:55 ` [FFmpeg-devel] [PATCH 2/3] avcodec/codec_par: Move enum AVFieldOrder to defs.h Andreas Rheinhardt
2023-09-26  0:35   ` James Almer
2023-09-26  9:17     ` Andreas Rheinhardt
2023-09-28 10:17       ` Anton Khirnov
2023-09-25 23:55 ` Andreas Rheinhardt [this message]
2023-09-26 10:49 ` [FFmpeg-devel] [PATCH v2 1/3] avformat/avformat: Deprecate AVFMT_ALLOW_FLUSH Anton Khirnov
2023-09-26 11:08   ` Martin Storsjö
2023-09-26 14:51     ` Andreas Rheinhardt
2023-09-27  8:51       ` Martin Storsjö
2023-09-28 10:38         ` Andreas Rheinhardt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AS8P250MB0744066117E5D57BE8A09C3C8FFCA@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM \
    --to=andreas.rheinhardt@outlook.com \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git