diff options
author | Limin Wang <lance.lmwang@gmail.com> | 2019-12-20 04:17:21 +0300 |
---|---|---|
committer | James Almer <jamrial@gmail.com> | 2019-12-20 19:55:22 +0300 |
commit | dbb051767fabddc58a7a24e72eeb715fd303dd62 (patch) | |
tree | dcaa63af7ad21446547b37ef10a14b64db85c0b0 /libavcodec/hevc_sei.c | |
parent | 99f505d2df521d83d53f7f9f9b359280f5af168b (diff) |
avcodec/hevc_sei: switch to AVBufferRef buffer for a53 caption
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavcodec/hevc_sei.c')
-rw-r--r-- | libavcodec/hevc_sei.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/libavcodec/hevc_sei.c b/libavcodec/hevc_sei.c index c59bd4321e..daca9d57bc 100644 --- a/libavcodec/hevc_sei.c +++ b/libavcodec/hevc_sei.c @@ -177,7 +177,8 @@ static int decode_registered_user_data_closed_caption(HEVCSEIA53Caption *s, GetB size -= 2; if (cc_count && size >= cc_count * 3) { - const uint64_t new_size = (s->a53_caption_size + cc_count + int old_size = s->buf_ref ? s->buf_ref->size : 0; + const uint64_t new_size = (old_size + cc_count * UINT64_C(3)); int i, ret; @@ -185,14 +186,14 @@ static int decode_registered_user_data_closed_caption(HEVCSEIA53Caption *s, GetB return AVERROR(EINVAL); /* Allow merging of the cc data from two fields. */ - ret = av_reallocp(&s->a53_caption, new_size); + ret = av_buffer_realloc(&s->buf_ref, new_size); if (ret < 0) return ret; for (i = 0; i < cc_count; i++) { - s->a53_caption[s->a53_caption_size++] = get_bits(gb, 8); - s->a53_caption[s->a53_caption_size++] = get_bits(gb, 8); - s->a53_caption[s->a53_caption_size++] = get_bits(gb, 8); + s->buf_ref->data[old_size++] = get_bits(gb, 8); + s->buf_ref->data[old_size++] = get_bits(gb, 8); + s->buf_ref->data[old_size++] = get_bits(gb, 8); } skip_bits(gb, 8); // marker_bits } @@ -363,6 +364,5 @@ int ff_hevc_decode_nal_sei(GetBitContext *gb, void *logctx, HEVCSEI *s, void ff_hevc_reset_sei(HEVCSEI *s) { - s->a53_caption.a53_caption_size = 0; - av_freep(&s->a53_caption.a53_caption); + av_buffer_unref(&s->a53_caption.buf_ref); } |