• Andreas Rheinhardt's avatar
    avcodec/cbs: Factor out common code for writing units · 7c92eaac
    Andreas Rheinhardt authored
    All cbs-functions to write units share a common pattern:
    1. They check whether they have a write buffer (that is used to store
    the unit's data until the needed size becomes known after writing the
    unit when a dedicated buffer will be allocated).
    2. They use this buffer for a PutBitContext.
    3. The (codec-specific) writing takes place through the PutBitContext.
    4. The return value is checked. AVERROR(ENOSPC) here always indicates
    that the buffer was too small and leads to a reallocation of said
    buffer.
    5. The final buffer will be allocated and the data copied.
    
    This commit factors this common code out in a single function in cbs.c.
    Signed-off-by: 's avatarAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
    7c92eaac
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...
.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...