[FFmpeg-cvslog] avformat/{aviobuf,avio_internal}: add ff_read_string_to_bprint_overwrite

Jan Ekström git at videolan.org
Mon Oct 4 18:25:05 EEST 2021


ffmpeg | branch: master | Jan Ekström <jan.ekstrom at 24i.com> | Mon Sep 20 14:30:14 2021 +0300| [151f46e84ddce557aace102a9f86f72d37e1cdbf] | committer: Jan Ekström

avformat/{aviobuf,avio_internal}: add ff_read_string_to_bprint_overwrite

For now, same as ff_read_line_to_bprint_overwrite, but reads until
the end of a null-terminated string.

Signed-off-by: Jan Ekström <jan.ekstrom at 24i.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=151f46e84ddce557aace102a9f86f72d37e1cdbf
---

 libavformat/avio_internal.h | 12 ++++++++++++
 libavformat/aviobuf.c       |  5 +++++
 2 files changed, 17 insertions(+)

diff --git a/libavformat/avio_internal.h b/libavformat/avio_internal.h
index 11060e9ff9..238b007396 100644
--- a/libavformat/avio_internal.h
+++ b/libavformat/avio_internal.h
@@ -245,4 +245,16 @@ struct AVBPrint;
  */
 int64_t ff_read_line_to_bprint_overwrite(AVIOContext *s, struct AVBPrint *bp);
 
+/**
+ * Read a whole null-terminated string of text from AVIOContext to an AVBPrint
+ * buffer overwriting its contents. Stop reading after reaching a \\0 or
+ * EOF.
+ *
+ * @param s the read-only AVIOContext
+ * @param bp the AVBPrint buffer
+ * @return the length of the read string not including the terminating null,
+ *         negative on error, or if the buffer becomes truncated.
+ */
+int64_t ff_read_string_to_bprint_overwrite(AVIOContext *s, AVBPrint *bp);
+
 #endif /* AVFORMAT_AVIO_INTERNAL_H */
diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
index f846a2fd6a..6ec20e33d2 100644
--- a/libavformat/aviobuf.c
+++ b/libavformat/aviobuf.c
@@ -863,6 +863,11 @@ int64_t ff_read_line_to_bprint_overwrite(AVIOContext *s, AVBPrint *bp)
     return read_string_to_bprint_overwrite(s, bp, FFBPrintReadLine);
 }
 
+int64_t ff_read_string_to_bprint_overwrite(AVIOContext *s, AVBPrint *bp)
+{
+    return read_string_to_bprint_overwrite(s, bp, FFBPrintReadString);
+}
+
 int avio_get_str(AVIOContext *s, int maxlen, char *buf, int buflen)
 {
     int i;



More information about the ffmpeg-cvslog mailing list