From f6774f905fb3cfdc319523ac640be30b14c1bc55 Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 31 Mar 2014 17:46:29 +0000 Subject: mpegvideo: operate with pointers to AVFrames instead of whole structs The most interesting parts are initialization in ff_MPV_common_init() and uninitialization in ff_MPV_common_end(). ff_mpeg_unref_picture and ff_thread_release_buffer have additional NULL checks for Picture.f, because these functions can be called on uninitialized or partially initialized Pictures. NULL pointer checks are added to ff_thread_release_buffer() stub function. Signed-off-by: Vittorio Giovara --- libavcodec/mpeg4videoenc.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'libavcodec/mpeg4videoenc.c') diff --git a/libavcodec/mpeg4videoenc.c b/libavcodec/mpeg4videoenc.c index 3ddc3e4bea..189664dc3d 100644 --- a/libavcodec/mpeg4videoenc.c +++ b/libavcodec/mpeg4videoenc.c @@ -675,7 +675,7 @@ void ff_mpeg4_encode_mb(MpegEncContext *s, int16_t block[6][64], y = s->height - 16; offset = x + y * s->linesize; - p_pic = s->new_picture.f.data[0] + offset; + p_pic = s->new_picture.f->data[0] + offset; s->mb_skipped = 1; for (i = 0; i < s->max_b_frames; i++) { @@ -683,10 +683,10 @@ void ff_mpeg4_encode_mb(MpegEncContext *s, int16_t block[6][64], int diff; Picture *pic = s->reordered_input_picture[i + 1]; - if (!pic || pic->f.pict_type != AV_PICTURE_TYPE_B) + if (!pic || pic->f->pict_type != AV_PICTURE_TYPE_B) break; - b_pic = pic->f.data[0] + offset; + b_pic = pic->f->data[0] + offset; if (!pic->shared) b_pic += INPLACE_OFFSET; diff = s->dsp.sad[0](NULL, p_pic, b_pic, s->linesize, 16); @@ -906,9 +906,9 @@ static void mpeg4_encode_gop_header(MpegEncContext *s) put_bits(&s->pb, 16, 0); put_bits(&s->pb, 16, GOP_STARTCODE); - time = s->current_picture_ptr->f.pts; + time = s->current_picture_ptr->f->pts; if (s->reordered_input_picture[1]) - time = FFMIN(time, s->reordered_input_picture[1]->f.pts); + time = FFMIN(time, s->reordered_input_picture[1]->f->pts); time = time * s->avctx->time_base.num; seconds = time / s->avctx->time_base.den; @@ -1118,7 +1118,7 @@ void ff_mpeg4_encode_picture_header(MpegEncContext *s, int picture_number) } put_bits(&s->pb, 3, 0); /* intra dc VLC threshold */ if (!s->progressive_sequence) { - put_bits(&s->pb, 1, s->current_picture_ptr->f.top_field_first); + put_bits(&s->pb, 1, s->current_picture_ptr->f->top_field_first); put_bits(&s->pb, 1, s->alternate_scan); } // FIXME sprite stuff -- cgit v1.2.1