From 2ba04bafb427ea93e3614c0469a6e13e55ac9dc9 Mon Sep 17 00:00:00 2001 From: Andreas Rheinhardt Date: Thu, 4 Aug 2022 11:31:18 +0200 Subject: avcodec/cbs: Remove ff_cbs_alloc_unit_content It is no longer used. Also rename ff_cbs_alloc_unit_content2 to ff_cbs_alloc_unit_content. Signed-off-by: Andreas Rheinhardt --- libavcodec/cbs.c | 24 ++---------------------- libavcodec/cbs.h | 13 ++----------- libavcodec/cbs_av1.c | 2 +- libavcodec/cbs_h2645.c | 4 ++-- libavcodec/cbs_jpeg.c | 2 +- libavcodec/cbs_mpeg2.c | 2 +- libavcodec/cbs_sei.c | 2 +- libavcodec/cbs_vp9.c | 2 +- 8 files changed, 11 insertions(+), 40 deletions(-) diff --git a/libavcodec/cbs.c b/libavcodec/cbs.c index 57b57238ed..07ae658a4c 100644 --- a/libavcodec/cbs.c +++ b/libavcodec/cbs.c @@ -695,26 +695,6 @@ int ff_cbs_write_signed(CodedBitstreamContext *ctx, PutBitContext *pbc, } -int ff_cbs_alloc_unit_content(CodedBitstreamUnit *unit, - size_t size, - void (*free)(void *opaque, uint8_t *data)) -{ - av_assert0(!unit->content && !unit->content_ref); - - unit->content = av_mallocz(size); - if (!unit->content) - return AVERROR(ENOMEM); - - unit->content_ref = av_buffer_create(unit->content, size, - free, NULL, 0); - if (!unit->content_ref) { - av_freep(&unit->content); - return AVERROR(ENOMEM); - } - - return 0; -} - static int cbs_insert_unit(CodedBitstreamFragment *frag, int position) { @@ -893,8 +873,8 @@ static const CodedBitstreamUnitTypeDescriptor return NULL; } -int ff_cbs_alloc_unit_content2(CodedBitstreamContext *ctx, - CodedBitstreamUnit *unit) +int ff_cbs_alloc_unit_content(CodedBitstreamContext *ctx, + CodedBitstreamUnit *unit) { const CodedBitstreamUnitTypeDescriptor *desc; diff --git a/libavcodec/cbs.h b/libavcodec/cbs.h index 5583063b5e..ee21623dac 100644 --- a/libavcodec/cbs.h +++ b/libavcodec/cbs.h @@ -363,22 +363,13 @@ void ff_cbs_fragment_reset(CodedBitstreamFragment *frag); */ void ff_cbs_fragment_free(CodedBitstreamFragment *frag); -/** - * Allocate a new internal content buffer of the given size in the unit. - * - * The content will be zeroed. - */ -int ff_cbs_alloc_unit_content(CodedBitstreamUnit *unit, - size_t size, - void (*free)(void *opaque, uint8_t *content)); - /** * Allocate a new internal content buffer matching the type of the unit. * * The content will be zeroed. */ -int ff_cbs_alloc_unit_content2(CodedBitstreamContext *ctx, - CodedBitstreamUnit *unit); +int ff_cbs_alloc_unit_content(CodedBitstreamContext *ctx, + CodedBitstreamUnit *unit); /** * Insert a new unit into a fragment with the given content. diff --git a/libavcodec/cbs_av1.c b/libavcodec/cbs_av1.c index 1229480567..154d9156cf 100644 --- a/libavcodec/cbs_av1.c +++ b/libavcodec/cbs_av1.c @@ -878,7 +878,7 @@ static int cbs_av1_read_unit(CodedBitstreamContext *ctx, GetBitContext gbc; int err, start_pos, end_pos; - err = ff_cbs_alloc_unit_content2(ctx, unit); + err = ff_cbs_alloc_unit_content(ctx, unit); if (err < 0) return err; obu = unit->content; diff --git a/libavcodec/cbs_h2645.c b/libavcodec/cbs_h2645.c index 117b609dc3..e0c617e81d 100644 --- a/libavcodec/cbs_h2645.c +++ b/libavcodec/cbs_h2645.c @@ -702,7 +702,7 @@ static int cbs_h264_read_nal_unit(CodedBitstreamContext *ctx, if (err < 0) return err; - err = ff_cbs_alloc_unit_content2(ctx, unit); + err = ff_cbs_alloc_unit_content(ctx, unit); if (err < 0) return err; @@ -821,7 +821,7 @@ static int cbs_h265_read_nal_unit(CodedBitstreamContext *ctx, if (err < 0) return err; - err = ff_cbs_alloc_unit_content2(ctx, unit); + err = ff_cbs_alloc_unit_content(ctx, unit); if (err < 0) return err; diff --git a/libavcodec/cbs_jpeg.c b/libavcodec/cbs_jpeg.c index 2afeecfa79..5921d624a1 100644 --- a/libavcodec/cbs_jpeg.c +++ b/libavcodec/cbs_jpeg.c @@ -227,7 +227,7 @@ static int cbs_jpeg_read_unit(CodedBitstreamContext *ctx, if (err < 0) return err; - err = ff_cbs_alloc_unit_content2(ctx, unit); + err = ff_cbs_alloc_unit_content(ctx, unit); if (err < 0) return err; diff --git a/libavcodec/cbs_mpeg2.c b/libavcodec/cbs_mpeg2.c index 1c9519cdaf..04b0c7f87d 100644 --- a/libavcodec/cbs_mpeg2.c +++ b/libavcodec/cbs_mpeg2.c @@ -204,7 +204,7 @@ static int cbs_mpeg2_read_unit(CodedBitstreamContext *ctx, if (err < 0) return err; - err = ff_cbs_alloc_unit_content2(ctx, unit); + err = ff_cbs_alloc_unit_content(ctx, unit); if (err < 0) return err; diff --git a/libavcodec/cbs_sei.c b/libavcodec/cbs_sei.c index 141e97ec58..50a513f592 100644 --- a/libavcodec/cbs_sei.c +++ b/libavcodec/cbs_sei.c @@ -179,7 +179,7 @@ static int cbs_sei_get_unit(CodedBitstreamContext *ctx, unit = &au->units[position]; unit->type = sei_type; - err = ff_cbs_alloc_unit_content2(ctx, unit); + err = ff_cbs_alloc_unit_content(ctx, unit); if (err < 0) return err; diff --git a/libavcodec/cbs_vp9.c b/libavcodec/cbs_vp9.c index ae7f88a8a3..184fdcade6 100644 --- a/libavcodec/cbs_vp9.c +++ b/libavcodec/cbs_vp9.c @@ -489,7 +489,7 @@ static int cbs_vp9_read_unit(CodedBitstreamContext *ctx, if (err < 0) return err; - err = ff_cbs_alloc_unit_content2(ctx, unit); + err = ff_cbs_alloc_unit_content(ctx, unit); if (err < 0) return err; frame = unit->content; -- cgit v1.2.3