diff mbox series

[FFmpeg-devel,2/6] avformat/internal: Move ff_read_line_to_bprint_overwrite to avio_internal.h

Message ID AM7PR03MB666007E181A90C254E5D272F8FE59@AM7PR03MB6660.eurprd03.prod.outlook.com
State Accepted
Commit fd101c9c3bcdeb2d74274aaeaa968fe8ead3622d
Headers show
Series [FFmpeg-devel,1/6] avformat/aviobuf: Make ff_read_line_to_bprint() static
Related show

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Andreas Rheinhardt July 23, 2021, 5:04 p.m. UTC
It only uses an AVIOContext and an AVBPrint.

When doing so, it turned out that several non-users of
ff_read_line_to_bprint_overwrite() and ff_bprint_to_codecpar_extradata()
relied on libavformat/internal.h to include bprint.h or avstring.h
for them. In order to avoid a repeat of this and in order to reduce
unnecessary dependencies, a forward declaration of struct AVBPrint is
used instead of including bprint.h.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavdevice/v4l2.c          |  1 +
 libavformat/aadec.c         |  1 +
 libavformat/argo_asf.c      |  1 +
 libavformat/argo_cvg.c      |  1 +
 libavformat/au.c            |  1 +
 libavformat/avio_internal.h | 14 ++++++++++++++
 libavformat/concatdec.c     |  1 +
 libavformat/dashdec.c       |  1 +
 libavformat/dashenc.c       |  1 +
 libavformat/flacenc.c       |  1 +
 libavformat/framecrcenc.c   |  1 +
 libavformat/hlsenc.c        |  1 +
 libavformat/internal.h      | 16 +---------------
 libavformat/librist.c       |  1 +
 libavformat/mxfdec.c        |  1 +
 libavformat/ttmlenc.c       |  1 +
 libavformat/utils.c         |  1 +
 17 files changed, 30 insertions(+), 15 deletions(-)
diff mbox series

Patch

diff --git a/libavdevice/v4l2.c b/libavdevice/v4l2.c
index 1c0de118cc..b5997fba33 100644
--- a/libavdevice/v4l2.c
+++ b/libavdevice/v4l2.c
@@ -33,6 +33,7 @@ 
 #include <stdatomic.h>
 
 #include "libavutil/avassert.h"
+#include "libavutil/avstring.h"
 #include "v4l2-common.h"
 #include <dirent.h>
 
diff --git a/libavformat/aadec.c b/libavformat/aadec.c
index 247c498147..9771a1df81 100644
--- a/libavformat/aadec.c
+++ b/libavformat/aadec.c
@@ -25,6 +25,7 @@ 
 
 #include "avformat.h"
 #include "internal.h"
+#include "libavutil/avstring.h"
 #include "libavutil/dict.h"
 #include "libavutil/intreadwrite.h"
 #include "libavutil/tea.h"
diff --git a/libavformat/argo_asf.c b/libavformat/argo_asf.c
index 0bc09522c0..5adafb7230 100644
--- a/libavformat/argo_asf.c
+++ b/libavformat/argo_asf.c
@@ -19,6 +19,7 @@ 
  * License along with FFmpeg; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
+#include "libavutil/avstring.h"
 #include "avformat.h"
 #include "internal.h"
 #include "libavutil/channel_layout.h"
diff --git a/libavformat/argo_cvg.c b/libavformat/argo_cvg.c
index 11f68c2405..e1854b4493 100644
--- a/libavformat/argo_cvg.c
+++ b/libavformat/argo_cvg.c
@@ -20,6 +20,7 @@ 
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#include "libavutil/avstring.h"
 #include "libavutil/channel_layout.h"
 #include "avformat.h"
 #include "internal.h"
diff --git a/libavformat/au.c b/libavformat/au.c
index ff8f841cce..9bd408f65c 100644
--- a/libavformat/au.c
+++ b/libavformat/au.c
@@ -27,6 +27,7 @@ 
  * http://www.goice.co.jp/member/mo/formats/au.html
  */
 
+#include "libavutil/bprint.h"
 #include "avformat.h"
 #include "internal.h"
 #include "avio_internal.h"
diff --git a/libavformat/avio_internal.h b/libavformat/avio_internal.h
index fe87f2a288..2c6d00b5ff 100644
--- a/libavformat/avio_internal.h
+++ b/libavformat/avio_internal.h
@@ -187,4 +187,18 @@  void ffio_reset_dyn_buf(AVIOContext *s);
  */
 void ffio_free_dyn_buf(AVIOContext **s);
 
+struct AVBPrint;
+/**
+ * Read a whole line of text from AVIOContext to an AVBPrint buffer overwriting
+ * its contents. Stop reading after reaching a \\r, a \\n, a \\r\\n, a \\0 or
+ * EOF. The line ending characters are NOT included in the buffer, but they
+ * are skipped on the input.
+ *
+ * @param s the read-only AVIOContext
+ * @param bp the AVBPrint buffer
+ * @return the length of the read line not including the line endings,
+ *         negative on error, or if the buffer becomes truncated.
+ */
+int64_t ff_read_line_to_bprint_overwrite(AVIOContext *s, struct AVBPrint *bp);
+
 #endif /* AVFORMAT_AVIO_INTERNAL_H */
diff --git a/libavformat/concatdec.c b/libavformat/concatdec.c
index 74354fce25..934e9c02fc 100644
--- a/libavformat/concatdec.c
+++ b/libavformat/concatdec.c
@@ -26,6 +26,7 @@ 
 #include "libavutil/timestamp.h"
 #include "libavcodec/bsf.h"
 #include "avformat.h"
+#include "avio_internal.h"
 #include "internal.h"
 #include "url.h"
 
diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
index 11966f905c..6105ec46d9 100644
--- a/libavformat/dashdec.c
+++ b/libavformat/dashdec.c
@@ -20,6 +20,7 @@ 
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 #include <libxml/parser.h>
+#include "libavutil/bprint.h"
 #include "libavutil/intreadwrite.h"
 #include "libavutil/opt.h"
 #include "libavutil/time.h"
diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index 2b8fbcbe6e..679e30611c 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -28,6 +28,7 @@ 
 #include "libavutil/avassert.h"
 #include "libavutil/avutil.h"
 #include "libavutil/avstring.h"
+#include "libavutil/bprint.h"
 #include "libavutil/intreadwrite.h"
 #include "libavutil/mathematics.h"
 #include "libavutil/opt.h"
diff --git a/libavformat/flacenc.c b/libavformat/flacenc.c
index d8cf3ea4db..44c9341493 100644
--- a/libavformat/flacenc.c
+++ b/libavformat/flacenc.c
@@ -19,6 +19,7 @@ 
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#include "libavutil/avstring.h"
 #include "libavutil/channel_layout.h"
 #include "libavutil/opt.h"
 #include "libavutil/pixdesc.h"
diff --git a/libavformat/framecrcenc.c b/libavformat/framecrcenc.c
index 56f7ea1b5a..ab79903e31 100644
--- a/libavformat/framecrcenc.c
+++ b/libavformat/framecrcenc.c
@@ -22,6 +22,7 @@ 
 #include <inttypes.h>
 
 #include "libavutil/adler32.h"
+#include "libavutil/avstring.h"
 
 #include "libavcodec/codec_id.h"
 #include "libavcodec/codec_par.h"
diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 151ef6ec8f..6447f9bf48 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -37,6 +37,7 @@ 
 #include "libavutil/mathematics.h"
 #include "libavutil/parseutils.h"
 #include "libavutil/avstring.h"
+#include "libavutil/bprint.h"
 #include "libavutil/intreadwrite.h"
 #include "libavutil/random_seed.h"
 #include "libavutil/opt.h"
diff --git a/libavformat/internal.h b/libavformat/internal.h
index d71852afb9..002aeb6601 100644
--- a/libavformat/internal.h
+++ b/libavformat/internal.h
@@ -23,8 +23,6 @@ 
 
 #include <stdint.h>
 
-#include "libavutil/bprint.h"
-
 #include "libavcodec/avcodec.h"
 #include "libavcodec/bsf.h"
 
@@ -539,19 +537,6 @@  int ff_get_line(AVIOContext *s, char *buf, int maxlen);
  */
 int ff_get_chomp_line(AVIOContext *s, char *buf, int maxlen);
 
-/**
- * Read a whole line of text from AVIOContext to an AVBPrint buffer overwriting
- * its contents. Stop reading after reaching a \\r, a \\n, a \\r\\n, a \\0 or
- * EOF. The line ending characters are NOT included in the buffer, but they
- * are skipped on the input.
- *
- * @param s the read-only AVIOContext
- * @param bp the AVBPrint buffer
- * @return the length of the read line not including the line endings,
- *         negative on error, or if the buffer becomes truncated.
- */
-int64_t ff_read_line_to_bprint_overwrite(AVIOContext *s, AVBPrint *bp);
-
 #define SPACE_CHARS " \t\r\n"
 
 /**
@@ -931,6 +916,7 @@  int ff_reshuffle_raw_rgb(AVFormatContext *s, AVPacket **ppkt, AVCodecParameters
  */
 int ff_get_packet_palette(AVFormatContext *s, AVPacket *pkt, int ret, uint32_t *palette);
 
+struct AVBPrint;
 /**
  * Finalize buf into extradata and set its size appropriately.
  */
diff --git a/libavformat/librist.c b/libavformat/librist.c
index 01a3f9c122..8f51050c3e 100644
--- a/libavformat/librist.c
+++ b/libavformat/librist.c
@@ -22,6 +22,7 @@ 
  */
 
 #include "libavutil/avassert.h"
+#include "libavutil/avstring.h"
 #include "libavutil/opt.h"
 #include "libavutil/parseutils.h"
 #include "libavutil/time.h"
diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index 52fbbc6e35..f93cc30f0e 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -47,6 +47,7 @@ 
 #include <inttypes.h>
 
 #include "libavutil/aes.h"
+#include "libavutil/avstring.h"
 #include "libavutil/mastering_display_metadata.h"
 #include "libavutil/mathematics.h"
 #include "libavcodec/bytestream.h"
diff --git a/libavformat/ttmlenc.c b/libavformat/ttmlenc.c
index 7577cb543b..8546d35196 100644
--- a/libavformat/ttmlenc.c
+++ b/libavformat/ttmlenc.c
@@ -27,6 +27,7 @@ 
  * @see https://www.w3.org/TR/ttml-imsc/rec
  */
 
+#include "libavutil/avstring.h"
 #include "avformat.h"
 #include "internal.h"
 #include "libavcodec/ttmlenc.h"
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 508a2b8bc2..60d7364018 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -25,6 +25,7 @@ 
 
 #include "libavutil/avassert.h"
 #include "libavutil/avstring.h"
+#include "libavutil/bprint.h"
 #include "libavutil/dict.h"
 #include "libavutil/internal.h"
 #include "libavutil/mathematics.h"