diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-12-19 17:33:45 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-12-19 21:46:11 +0100 |
commit | 971c469a0d014121718ccfe1208da045fd098ab0 (patch) | |
tree | 1f841529c9efdf32398d0d90bc9b163483922ad6 /libavcodec/h264.c | |
parent | 25a0af51da5fed3b86314c4c9a49f9cebb5cec78 (diff) | |
download | ffmpeg-971c469a0d014121718ccfe1208da045fd098ab0.tar.gz |
h264: split flush_change() out of flush_dpb()
Based on a patch by Janne Grunau
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/h264.c')
-rw-r--r-- | libavcodec/h264.c | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/libavcodec/h264.c b/libavcodec/h264.c index 010bb03b67..367f9f611f 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c @@ -2102,15 +2102,9 @@ static void idr(H264Context *h) } /* forget old pics after a seek */ -static void flush_dpb(AVCodecContext *avctx) +static void flush_change(H264Context *h) { - H264Context *h = avctx->priv_data; int i; - for (i=0; i<=MAX_DELAYED_PIC_COUNT; i++) { - if (h->delayed_pic[i]) - h->delayed_pic[i]->f.reference = 0; - h->delayed_pic[i] = NULL; - } h->outputed_poc = h->next_outputed_poc = INT_MIN; h->prev_interlaced_frame = 1; idr(h); @@ -2118,12 +2112,31 @@ static void flush_dpb(AVCodecContext *avctx) if (h->s.current_picture_ptr) h->s.current_picture_ptr->f.reference = 0; h->s.first_field = 0; + memset(h->ref_list[0], 0, sizeof(h->ref_list[0])); + memset(h->ref_list[1], 0, sizeof(h->ref_list[1])); + memset(h->default_ref_list[0], 0, sizeof(h->default_ref_list[0])); + memset(h->default_ref_list[1], 0, sizeof(h->default_ref_list[1])); ff_h264_reset_sei(h); - ff_mpeg_flush(avctx); h->recovery_frame= -1; h->sync= 0; } +/* forget old pics after a seek */ +static void flush_dpb(AVCodecContext *avctx) +{ + H264Context *h = avctx->priv_data; + int i; + + for (i = 0; i <= MAX_DELAYED_PIC_COUNT; i++) { + if (h->delayed_pic[i]) + h->delayed_pic[i]->f.reference = 0; + h->delayed_pic[i] = NULL; + } + + flush_change(h); + ff_mpeg_flush(avctx); +} + static int init_poc(H264Context *h) { MpegEncContext *const s = &h->s; |