]> git.sesse.net Git - ffmpeg/commit
avformat/matroskaenc: Write level 1 elements in one go
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Mon, 30 Dec 2019 14:59:02 +0000 (15:59 +0100)
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Mon, 30 Mar 2020 04:26:34 +0000 (06:26 +0200)
commitd9c21ec63999501afc39ffc26f363245e8624304
tree641b4a4657defe76bf1441a0aeaac318538f33b9
parent5e3b7bd56d2c476a508c03e2029675bfd2618122
avformat/matroskaenc: Write level 1 elements in one go

Up until now, writing level 1 elements proceeded as follows: First, the
element id was written to the ordinary output AVIOContext and a dynamic
buffer was opened for the content of the level 1 element in
start_ebml_master_crc32(). Then this buffer was actually used and after it
was closed (in end_ebml_master_crc32()), the size field corresponding to
the buffer's size was written, after which the actual data was written.

This commit changes this: Nothing is written to the main AVIOContext any
more in start_ebml_master_crc32(). end_ebml_master_crc32() now writes
both the id, the length field as well as the data. This implies that
one can start a level 1 element in memory without outputting anything.
This is done to enable to test whether enough space has been reserved
for the Cues (if space has been reserved for them) before writing them.
A large duration between outputting the header and outputting the rest
could also break certain streaming usecases like the one from #8578
(which this commit fixes).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
libavformat/matroskaenc.c