[FFmpeg-devel] [PATCH 05/10] avformat/nutenc: Create put_* functions by macro

Andreas Rheinhardt andreas.rheinhardt at gmail.com
Sat May 9 07:04:13 EEST 2020


Michael Niedermayer:
> On Mon, May 04, 2020 at 08:22:45PM +0200, Andreas Rheinhardt wrote:
>> It allows to add analogous functions using e.g. the bytestream API
>> instead of using an AVIOContext.
>>
>> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
>> ---
>>  libavformat/nutenc.c | 49 ++++++++++++++++++++++++--------------------
>>  1 file changed, 27 insertions(+), 22 deletions(-)
> 
> It certainly is possible to use macros to make the put functions work
> with 2 unrelated APIs.
> But pretty it is not, why do we need 2 APIs ?
> 
This is done in preparation for patch 6/10 [1] that separates the
several variable-length elements that precede the main content (or in
case of the syncpoint structure: that is the complete content). By
putting them in a separate buffer one can eliminate one level of dynamic
buffers. And given that these little buffers are naturally given as
buffers, using the bytestream API seems the easiest and nicest way.

While one could of course achieve the same by wrapping these little
buffers in an AVIOContext via ffio_init_context(), I don't consider this
pretty.

- Andreas

[1]: https://ffmpeg.org/pipermail/ffmpeg-devel/2020-May/262109.html


More information about the ffmpeg-devel mailing list