aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/cbs.c
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2022-02-04 13:58:36 +0100
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2022-02-08 06:02:05 +0100
commit66d7a211329e79ad61316f67726e89d07c21d862 (patch)
tree11443906bf254d945d2955aec26bcf3040dfd1af /libavcodec/cbs.c
parentf183ae787a73f263706212dde151c1edddd6fb1c (diff)
downloadffmpeg-66d7a211329e79ad61316f67726e89d07c21d862.tar.gz
avcodec/cbs: Make ff_cbs_insert_unit_data() always append the new unit
All split functions (the only users of this function) only append units. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavcodec/cbs.c')
-rw-r--r--libavcodec/cbs.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/libavcodec/cbs.c b/libavcodec/cbs.c
index d7aa67c3af..e829caa0a0 100644
--- a/libavcodec/cbs.c
+++ b/libavcodec/cbs.c
@@ -789,18 +789,16 @@ int ff_cbs_insert_unit_content(CodedBitstreamFragment *frag,
return 0;
}
-int ff_cbs_insert_unit_data(CodedBitstreamFragment *frag,
- int position,
- CodedBitstreamUnitType type,
- uint8_t *data, size_t data_size,
- AVBufferRef *data_buf)
+static int cbs_insert_unit_data(CodedBitstreamFragment *frag,
+ CodedBitstreamUnitType type,
+ uint8_t *data, size_t data_size,
+ AVBufferRef *data_buf,
+ int position)
{
CodedBitstreamUnit *unit;
AVBufferRef *data_ref;
int err;
- if (position == -1)
- position = frag->nb_units;
av_assert0(position >= 0 && position <= frag->nb_units);
if (data_buf)
@@ -828,6 +826,16 @@ int ff_cbs_insert_unit_data(CodedBitstreamFragment *frag,
return 0;
}
+int ff_cbs_append_unit_data(CodedBitstreamFragment *frag,
+ CodedBitstreamUnitType type,
+ uint8_t *data, size_t data_size,
+ AVBufferRef *data_buf)
+{
+ return cbs_insert_unit_data(frag, type,
+ data, data_size, data_buf,
+ frag->nb_units);
+}
+
void ff_cbs_delete_unit(CodedBitstreamFragment *frag,
int position)
{