diff options
author | Gildas Cocherel <gildas.cocherel@laposte.net> | 2013-12-10 15:42:28 +0100 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2013-12-11 20:39:54 +0100 |
commit | 33452aede6acab78f726cd1924824585f00765cc (patch) | |
tree | 1308202d92537c6330a95cf46beb0e22fbf7b891 /libavcodec/hevc_ps.c | |
parent | b769cf4b44c8112827c2fdfcab74bd95600fd6d3 (diff) | |
download | ffmpeg-33452aede6acab78f726cd1924824585f00765cc.tar.gz |
hevc: store the VPS list as an AVBufferRef, just like the others *PS
Signed-off-by: Anton Khirnov <anton@khirnov.net>
Diffstat (limited to 'libavcodec/hevc_ps.c')
-rw-r--r-- | libavcodec/hevc_ps.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/libavcodec/hevc_ps.c b/libavcodec/hevc_ps.c index 402c16fef8..d9811253ee 100644 --- a/libavcodec/hevc_ps.c +++ b/libavcodec/hevc_ps.c @@ -328,12 +328,13 @@ int ff_hevc_decode_nal_vps(HEVCContext *s) GetBitContext *gb = &s->HEVClc.gb; int vps_id = 0; HEVCVPS *vps; + AVBufferRef *vps_buf = av_buffer_allocz(sizeof(*vps)); - av_log(s->avctx, AV_LOG_DEBUG, "Decoding VPS\n"); + if (!vps_buf) + return AVERROR(ENOMEM); + vps = (HEVCVPS*)vps_buf->data; - vps = av_mallocz(sizeof(*vps)); - if (!vps) - return AVERROR(ENOMEM); + av_log(s->avctx, AV_LOG_DEBUG, "Decoding VPS\n"); vps_id = get_bits(gb, 4); if (vps_id >= MAX_VPS_COUNT) { @@ -410,12 +411,12 @@ int ff_hevc_decode_nal_vps(HEVCContext *s) } get_bits1(gb); /* vps_extension_flag */ - av_free(s->vps_list[vps_id]); - s->vps_list[vps_id] = vps; + av_buffer_unref(&s->vps_list[vps_id]); + s->vps_list[vps_id] = vps_buf; return 0; err: - av_free(vps); + av_buffer_unref(&vps_buf); return AVERROR_INVALIDDATA; } |