• Andreas Rheinhardt's avatar
    avformat/matroskaenc: Remove allocations for Attachments · 358b58cb
    Andreas Rheinhardt authored
    If there are Attachments to write, the Matroska muxer currently
    allocates two objects: An array that contains an entry for each
    AttachedFile containing just the stream index of the corresponding
    stream and the FileUID used for this AttachedFile; and a structure with
    a pointer to said array and a counter for said array. These uids are
    generated via code special to Attachments: It uses an AVLFG in the
    normal and a sha of the attachment data in the bitexact case. (Said sha
    requires an allocation, too.)
    
    But now that an uid is generated for each stream in mkv_init(), there is
    no need any more to use special code for generating the FileUIDs of
    AttachedFiles: One can simply use the uid already generated for the
    corresponding stream. And this makes the whole allocations of the
    structures for AttachedFiles as well as the structures itself superfluous.
    They have been removed.
    
    In case AVFMT_FLAG_BITEXACT is set, the uids will be different from the
    old ones which is the reason why the FATE-test lavf-mkv_attachment
    needed to be updated. The old method had the drawback that two
    AttachedFiles with the same data would have the same FileUID.
    The new one doesn't.
    
    Also notice that the dynamic buffer used to write the Attachments leaks
    if an error happens when writing the buffer. By removing the
    allocations potential sources of errors have been removed.
    Signed-off-by: 's avatarAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
    358b58cb
Name
Last commit
Last update
compat Loading commit data...
doc Loading commit data...
ffbuild Loading commit data...
fftools Loading commit data...
libavcodec Loading commit data...
libavdevice Loading commit data...
libavfilter Loading commit data...
libavformat Loading commit data...
libavresample Loading commit data...
libavutil Loading commit data...
libpostproc Loading commit data...
libswresample Loading commit data...
libswscale Loading commit data...
presets Loading commit data...
tests Loading commit data...
tools Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
.mailmap Loading commit data...
.travis.yml Loading commit data...
CONTRIBUTING.md Loading commit data...
COPYING.GPLv2 Loading commit data...
COPYING.GPLv3 Loading commit data...
COPYING.LGPLv2.1 Loading commit data...
COPYING.LGPLv3 Loading commit data...
CREDITS Loading commit data...
Changelog Loading commit data...
INSTALL.md Loading commit data...
LICENSE.md Loading commit data...
MAINTAINERS Loading commit data...
Makefile Loading commit data...
README.md Loading commit data...
RELEASE Loading commit data...
configure Loading commit data...