]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/hevc_ps: add a function to uninitialize parameter set buffers
authorJames Almer <jamrial@gmail.com>
Sat, 20 Jan 2018 19:54:15 +0000 (16:54 -0300)
committerJames Almer <jamrial@gmail.com>
Sun, 21 Jan 2018 03:06:30 +0000 (00:06 -0300)
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
libavcodec/hevc_ps.c
libavcodec/hevc_ps.h

index a4f7ed60f7ec5d26ec65eb94e7b3c741252c7fd5..4787312cfaa0eefed0a884097de727957bb1d73a 100644 (file)
@@ -1704,6 +1704,22 @@ err:
     return ret;
 }
 
+void ff_hevc_ps_uninit(HEVCParamSets *ps)
+{
+    int i;
+
+    for (i = 0; i < FF_ARRAY_ELEMS(ps->vps_list); i++)
+        av_buffer_unref(&ps->vps_list[i]);
+    for (i = 0; i < FF_ARRAY_ELEMS(ps->sps_list); i++)
+        av_buffer_unref(&ps->sps_list[i]);
+    for (i = 0; i < FF_ARRAY_ELEMS(ps->pps_list); i++)
+        av_buffer_unref(&ps->pps_list[i]);
+
+    ps->sps = NULL;
+    ps->pps = NULL;
+    ps->vps = NULL;
+}
+
 int ff_hevc_compute_poc(const HEVCSPS *sps, int pocTid0, int poc_lsb, int nal_unit_type)
 {
     int max_poc_lsb  = 1 << sps->log2_max_poc_lsb;
index 477ee4299a6db3267d5d2ef7de87a26a7cbba729..9873754389cc5faf90b7b00fe7150ef312661a07 100644 (file)
@@ -421,6 +421,8 @@ int ff_hevc_decode_nal_sps(GetBitContext *gb, AVCodecContext *avctx,
 int ff_hevc_decode_nal_pps(GetBitContext *gb, AVCodecContext *avctx,
                            HEVCParamSets *ps);
 
+void ff_hevc_ps_uninit(HEVCParamSets *ps);
+
 int ff_hevc_decode_short_term_rps(GetBitContext *gb, AVCodecContext *avctx,
                                   ShortTermRPS *rps, const HEVCSPS *sps, int is_slice_header);