• Andreas Rheinhardt's avatar
    avformat/segafilmenc: Avoid seek when writing header · 37f5fecc
    Andreas Rheinhardt authored
    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: 's avatarAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
    37f5fecc
segafilmenc.c 11.8 KB