Commit 0ea58059 authored by Matthieu Bouron's avatar Matthieu Bouron

lavc/h264_ps: add ff_h264_ps_uninit and use it

parent acfab2dc
...@@ -377,15 +377,7 @@ static av_cold int h264_decode_end(AVCodecContext *avctx) ...@@ -377,15 +377,7 @@ static av_cold int h264_decode_end(AVCodecContext *avctx)
h->nb_slice_ctx = 0; h->nb_slice_ctx = 0;
ff_h264_sei_uninit(&h->sei); ff_h264_sei_uninit(&h->sei);
ff_h264_ps_uninit(&h->ps);
for (i = 0; i < MAX_SPS_COUNT; i++)
av_buffer_unref(&h->ps.sps_list[i]);
for (i = 0; i < MAX_PPS_COUNT; i++)
av_buffer_unref(&h->ps.pps_list[i]);
av_buffer_unref(&h->ps.sps_ref);
av_buffer_unref(&h->ps.pps_ref);
ff_h2645_packet_uninit(&h->pkt); ff_h2645_packet_uninit(&h->pkt);
......
...@@ -694,6 +694,12 @@ typedef struct H264Context { ...@@ -694,6 +694,12 @@ typedef struct H264Context {
extern const uint16_t ff_h264_mb_sizes[4]; extern const uint16_t ff_h264_mb_sizes[4];
/**
* Uninit H264 param sets structure.
*/
void ff_h264_ps_uninit(H264ParamSets *ps);
/** /**
* Decode SPS * Decode SPS
*/ */
......
...@@ -649,17 +649,11 @@ static void h264_close(AVCodecParserContext *s) ...@@ -649,17 +649,11 @@ static void h264_close(AVCodecParserContext *s)
{ {
H264ParseContext *p = s->priv_data; H264ParseContext *p = s->priv_data;
ParseContext *pc = &p->pc; ParseContext *pc = &p->pc;
int i;
av_freep(&pc->buffer); av_freep(&pc->buffer);
ff_h264_sei_uninit(&p->sei); ff_h264_sei_uninit(&p->sei);
ff_h264_ps_uninit(&p->ps);
for (i = 0; i < FF_ARRAY_ELEMS(p->ps.sps_list); i++)
av_buffer_unref(&p->ps.sps_list[i]);
for (i = 0; i < FF_ARRAY_ELEMS(p->ps.pps_list); i++)
av_buffer_unref(&p->ps.pps_list[i]);
} }
static av_cold int init(AVCodecParserContext *s) static av_cold int init(AVCodecParserContext *s)
......
...@@ -298,6 +298,23 @@ static void decode_scaling_matrices(GetBitContext *gb, SPS *sps, ...@@ -298,6 +298,23 @@ static void decode_scaling_matrices(GetBitContext *gb, SPS *sps,
} }
} }
void ff_h264_ps_uninit(H264ParamSets *ps)
{
int i;
for (i = 0; i < MAX_SPS_COUNT; i++)
av_buffer_unref(&ps->sps_list[i]);
for (i = 0; i < MAX_PPS_COUNT; i++)
av_buffer_unref(&ps->pps_list[i]);
av_buffer_unref(&ps->sps_ref);
av_buffer_unref(&ps->pps_ref);
ps->pps = NULL;
ps->sps = NULL;
}
int ff_h264_decode_seq_parameter_set(GetBitContext *gb, AVCodecContext *avctx, int ff_h264_decode_seq_parameter_set(GetBitContext *gb, AVCodecContext *avctx,
H264ParamSets *ps, int ignore_truncation) H264ParamSets *ps, int ignore_truncation)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment