summaryrefslogtreecommitdiff
path: root/libavformat/avio_internal.h
diff options
context:
space:
mode:
authorJan Ekström <jan.ekstrom@24i.com>2021-09-20 14:51:42 +0300
committerJan Ekström <jeebjp@gmail.com>2021-10-04 17:13:21 +0300
commit847fd8de7c13abe41ca59464014f17c56555ef7b (patch)
tree1e1c3c197fa8e41e2315880daa26ec670a9f80f2 /libavformat/avio_internal.h
parent151f46e84ddce557aace102a9f86f72d37e1cdbf (diff)
avformat/{aviobuf,avio_internal}: add max_len argument to ff_read_string_to_bprint_overwrite
This is especially useful when reading things such as null-terminated strings from MOV/MP4-likes, where the size of the box is known, but not the exact size of the string. Signed-off-by: Jan Ekström <jan.ekstrom@24i.com>
Diffstat (limited to 'libavformat/avio_internal.h')
-rw-r--r--libavformat/avio_internal.h13
1 files changed, 10 insertions, 3 deletions
diff --git a/libavformat/avio_internal.h b/libavformat/avio_internal.h
index 238b007396..eded38759b 100644
--- a/libavformat/avio_internal.h
+++ b/libavformat/avio_internal.h
@@ -247,14 +247,21 @@ 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.
+ * buffer overwriting its contents. Stop reading after reaching the maximum
+ * length, a \\0 or EOF.
*
* @param s the read-only AVIOContext
* @param bp the AVBPrint buffer
+ * @param max_len the maximum length to be read from the AVIOContext.
+ * Negative (< 0) values signal that there is no known maximum
+ * length applicable. A maximum length of zero means that the
+ * AVIOContext is not touched, and the function returns
+ * with a read length of zero. In all cases the AVBprint
+ * is cleared.
* @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);
+int64_t ff_read_string_to_bprint_overwrite(AVIOContext *s, struct AVBPrint *bp,
+ int64_t max_len);
#endif /* AVFORMAT_AVIO_INTERNAL_H */