[FFmpeg-devel] [PATCH 2/2 v2] avformat/flacenc: add flac_init() and flac_deinit()

James Almer jamrial at gmail.com
Fri Nov 24 16:05:24 EET 2017

On 11/24/2017 8:19 AM, Carl Eugen Hoyos wrote:
> 2017-11-24 4:38 GMT+01:00 James Almer <jamrial at gmail.com>:
>> Signed-off-by: James Almer <jamrial at gmail.com>
>> ---
>> Simpler/smaller diff.
> Sorry if this is obvious:
> What is the advantage of having these new functions?
> Carl Eugen

Muxers with an init() function can be initialized before the header is
written. deinit() is mainly meant to free any allocated buffer in init()
in case the latter fails, but should ideally also be used to free what
would otherwise be freed in write_trailer().
API users can know if muxing is possible and in some cases have the
output streams initialized with container specific parameters by calling
avformat_init_output() before avformat_write_header() with the above

ffmpeg.c should ideally be doing the above, so we can remove all the
delayed header writing code in libavformat/mux.c (see the patch i sent
for the latter some time ago).

More information about the ffmpeg-devel mailing list