[FFmpeg-devel] [PATCH 2/2] doc/plans: add AVWriter

Nicolas George george at nsup.org
Thu Aug 18 00:49:32 EEST 2022


Signed-off-by: Nicolas George <george at nsup.org>
---
 doc/plans.md | 38 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)

diff --git a/doc/plans.md b/doc/plans.md
index 0d7336e8b4..d96328aabc 100644
--- a/doc/plans.md
+++ b/doc/plans.md
@@ -4,3 +4,41 @@ Projects listed below have been approved by the FFmpeg developers community,
 and their author(s) can invest time and effort implementing them. The
 resulting patches will be subject to technical review like any other
 patches, but they can no longer be rejected on principle.
+
+## AVWriter: a unified API for building and returning strings
+
+**Author:** Nicolas George
+
+An API that can be used everywhere a function needs to return a string, or
+really an arbitrary buffer of bytes, and everywhere code needs to build a
+string from parts. It needs to be fast and lightweight enough to be used in
+tight loops, like once per frame, without limiting the size of the returned
+string when needed. It should make checking for overflows and possible
+memory allocation errors simple. It should easily be compatible with other
+uses of strings, especially standard C buffers.
+
+AVWriter is an enhancement on the AVBPrint API; AVBPrint already achieves
+some of these objectives but not all.
+
+Like other FFmpeg components, AVWriter is designed as a limited
+object-oriented virtual class / interface with multiple implementations. To
+let applications define their own writers and allocate structures on the
+stack or as part of their data, structures contain their own size and the
+code only accesses fields that exist.
+
+Some functions are specific to a particular implementation of AVWriter; for
+example getting a mallocated buffer from a dynamic AVWriter. It is the
+responsibility of the caller to use the right type, which will usually be
+enforced by an assert.
+
+**Future plans where AVWriter will help:**
+
+A universal API to return the string associated with an elementary type
+(pixel format, channel layout, etc.) and to serialize complex types,
+especially side data.
+
+A system to store error messages in contexts instead of logging them, to
+make it easier for applications, especially GUI, to display them cleanly.
+
+An extension to `avwriter_printf()` to use any serializable object directly
+from the format string.
-- 
2.35.1



More information about the ffmpeg-devel mailing list