]> git.sesse.net Git - ffmpeg/commit
avformat/matroskaenc: Only write Cues at the front if space has been reserved
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Fri, 1 May 2020 23:47:17 +0000 (01:47 +0200)
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Mon, 18 May 2020 23:12:06 +0000 (01:12 +0200)
commita54c94d95f92962dfd32cd7084d553cbf01983e7
tree088243e98640a7c0eadf21f6fcda0e27619ce7bf
parent81e39cf4814fac2acff92a3db586428dbf3b6892
avformat/matroskaenc: Only write Cues at the front if space has been reserved

If the AVIOContext for output was unseekable when writing the header,
no space for Cues would be reserved even if the reserve_index_space
option was used (because it is reasonable to expect that one can't seek
back to the beginning to write the Cues anyway). But if the AVIOContext
was seekable when writing the trailer, it was presumed that space for
the Cues had been reserved when the reserve_index_space option indicated
so even when it was not. As a result, the beginning of the file would be
overwritten.

This commit fixes this: If the reserve_index_space option had been used
and no space has been reserved in advance because of unseekability when
writing the header, then no attempt to write Cues will be performed
when writing the trailer; after all, writing them at the front is
impossible and writing them at the end is probably undesired.

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