]> git.sesse.net Git - ffmpeg/commit
avformat/segafilmenc: Avoid seek when writing header
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Fri, 17 Jul 2020 10:04:03 +0000 (12:04 +0200)
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Sun, 26 Jul 2020 15:10:06 +0000 (17:10 +0200)
commit37f5feccc61726d8be6045ed4e853286ad3c487c
tree9a2542fb4b8c59feac40f6bfe3b7901ab36e730c
parent8a3329ffba0070bd22cc72287d3dc7cbb96e9e9e
avformat/segafilmenc: Avoid seek when writing header

Up until now, the Sega FILM muxer would first write all the packet data,
then shift the data (in the muxer's write_trailer function) by the amount
necessary to write the header at the front (which entails a seek to the
front), then seek back to the beginning and actually write the header.

This commit changes this: The dynamic buffer that is used to write the
sample table (containing information about each sample in the file) is
now used to write the complete header. This is possible because the size
of everything in the header except the sample table is known in advance.
Said buffer can then be used as one of the two temporary buffers used
for shifting which also reduces the amount one has to allocate for this.
Thereby the header will be written when shifting, so that the second
seek to the beginning is unnecessary.

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