[FFmpeg-devel] [PATCH 5/5] avcodec/mpeg12: Move ff_mpeg1_clean_buffers decl to a new header
Andreas Rheinhardt
andreas.rheinhardt at outlook.com
Fri Sep 30 05:18:54 EEST 2022
It allows to avoid including mpegvideo.h when including mpeg12.h.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
---
libavcodec/mpeg12.c | 1 +
libavcodec/mpeg12.h | 10 +++++++---
libavcodec/mpeg12codecs.h | 29 +++++++++++++++++++++++++++++
libavcodec/mpeg12dec.c | 1 +
libavcodec/mpegvideo_enc.c | 2 +-
libavcodec/tests/mpeg12framerate.c | 3 +++
6 files changed, 42 insertions(+), 4 deletions(-)
create mode 100644 libavcodec/mpeg12codecs.h
diff --git a/libavcodec/mpeg12.c b/libavcodec/mpeg12.c
index 7f2aaea7c0..df6aba9d74 100644
--- a/libavcodec/mpeg12.c
+++ b/libavcodec/mpeg12.c
@@ -34,6 +34,7 @@
#include "avcodec.h"
#include "mpegvideo.h"
#include "mpeg12.h"
+#include "mpeg12codecs.h"
#include "mpeg12data.h"
#include "mpeg12dec.h"
#include "startcode.h"
diff --git a/libavcodec/mpeg12.h b/libavcodec/mpeg12.h
index b323728a33..4e2e67eae1 100644
--- a/libavcodec/mpeg12.h
+++ b/libavcodec/mpeg12.h
@@ -22,7 +22,7 @@
#ifndef AVCODEC_MPEG12_H
#define AVCODEC_MPEG12_H
-#include "mpegvideo.h"
+#include "libavutil/rational.h"
/* Start codes. */
#define SEQ_END_CODE 0x000001b7
@@ -34,9 +34,13 @@
#define EXT_START_CODE 0x000001b5
#define USER_START_CODE 0x000001b2
-void ff_mpeg1_clean_buffers(MpegEncContext *s);
+#include "version_major.h"
#if FF_API_FLAG_TRUNCATED
-int ff_mpeg1_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size, AVCodecParserContext *s);
+#include <stdint.h>
+
+struct ParseContext;
+struct AVCodecParserContext;
+int ff_mpeg1_find_frame_end(struct ParseContext *pc, const uint8_t *buf, int buf_size, struct AVCodecParserContext *s);
#endif
void ff_mpeg12_find_best_frame_rate(AVRational frame_rate,
diff --git a/libavcodec/mpeg12codecs.h b/libavcodec/mpeg12codecs.h
new file mode 100644
index 0000000000..f8cf5503e2
--- /dev/null
+++ b/libavcodec/mpeg12codecs.h
@@ -0,0 +1,29 @@
+/*
+ * MPEG-1/2 codecs common code
+ * Copyright (c) 2007 Aurelien Jacobs <aurel at gnuage.org>
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef AVCODEC_MPEG12CODECS_H
+#define AVCODEC_MPEG12CODECS_H
+
+#include "mpegvideo.h"
+
+void ff_mpeg1_clean_buffers(MpegEncContext *s);
+
+#endif /* AVCODEC_MPEG12CODECS_H */
diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
index dad1970f6c..df76a90c6c 100644
--- a/libavcodec/mpeg12dec.c
+++ b/libavcodec/mpeg12dec.c
@@ -47,6 +47,7 @@
#include "internal.h"
#include "mpeg_er.h"
#include "mpeg12.h"
+#include "mpeg12codecs.h"
#include "mpeg12data.h"
#include "mpeg12dec.h"
#include "mpegutils.h"
diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index 0b398c56ab..06c3ff4cbe 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -46,7 +46,7 @@
#include "dct.h"
#include "encode.h"
#include "idctdsp.h"
-#include "mpeg12.h"
+#include "mpeg12codecs.h"
#include "mpeg12data.h"
#include "mpeg12enc.h"
#include "mpegvideo.h"
diff --git a/libavcodec/tests/mpeg12framerate.c b/libavcodec/tests/mpeg12framerate.c
index 595bdb278a..f2d3e2472c 100644
--- a/libavcodec/tests/mpeg12framerate.c
+++ b/libavcodec/tests/mpeg12framerate.c
@@ -16,6 +16,9 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <stddef.h>
+
+#include "libavutil/log.h"
#include "libavcodec/mpeg12.h"
#include "libavcodec/mpeg12data.h"
--
2.34.1
More information about the ffmpeg-devel
mailing list