diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2021-09-06 12:37:26 +0200 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2021-09-08 22:59:14 +0200 |
commit | fd43b868e1293b4d72323a861994f65456d060b6 (patch) | |
tree | f6e30127b1175ed725ba8eecbca820b362027e2f /libavcodec/cbs.c | |
parent | 97bc4695fb7a51574d863812af58ab63746558fd (diff) | |
download | ffmpeg-fd43b868e1293b4d72323a861994f65456d060b6.tar.gz |
avcodec/cbs: Make ff_cbs_alloc_unit_data() static
Forgotten in 7c92eaace2b338e0b3acc18e1543b365610578fd.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavcodec/cbs.c')
-rw-r--r-- | libavcodec/cbs.c | 41 |
1 files changed, 23 insertions, 18 deletions
diff --git a/libavcodec/cbs.c b/libavcodec/cbs.c index f6e371ddef..d7aa67c3af 100644 --- a/libavcodec/cbs.c +++ b/libavcodec/cbs.c @@ -315,6 +315,28 @@ int ff_cbs_read(CodedBitstreamContext *ctx, data, size, 0); } +/** + * Allocate a new internal data buffer of the given size in the unit. + * + * The data buffer will have input padding. + */ +static int cbs_alloc_unit_data(CodedBitstreamUnit *unit, + size_t size) +{ + av_assert0(!unit->data && !unit->data_ref); + + unit->data_ref = av_buffer_alloc(size + AV_INPUT_BUFFER_PADDING_SIZE); + if (!unit->data_ref) + return AVERROR(ENOMEM); + + unit->data = unit->data_ref->data; + unit->data_size = size; + + memset(unit->data + size, 0, AV_INPUT_BUFFER_PADDING_SIZE); + + return 0; +} + static int cbs_write_unit_data(CodedBitstreamContext *ctx, CodedBitstreamUnit *unit) { @@ -360,7 +382,7 @@ static int cbs_write_unit_data(CodedBitstreamContext *ctx, flush_put_bits(&pbc); - ret = ff_cbs_alloc_unit_data(unit, put_bytes_output(&pbc)); + ret = cbs_alloc_unit_data(unit, put_bytes_output(&pbc)); if (ret < 0) return ret; @@ -693,23 +715,6 @@ int ff_cbs_alloc_unit_content(CodedBitstreamUnit *unit, return 0; } -int ff_cbs_alloc_unit_data(CodedBitstreamUnit *unit, - size_t size) -{ - av_assert0(!unit->data && !unit->data_ref); - - unit->data_ref = av_buffer_alloc(size + AV_INPUT_BUFFER_PADDING_SIZE); - if (!unit->data_ref) - return AVERROR(ENOMEM); - - unit->data = unit->data_ref->data; - unit->data_size = size; - - memset(unit->data + size, 0, AV_INPUT_BUFFER_PADDING_SIZE); - - return 0; -} - static int cbs_insert_unit(CodedBitstreamFragment *frag, int position) { |