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/mpeg12enc.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'libavcodec/mpeg12enc.c') diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c index 6c4ef6d7e4..c12491eaf2 100644 --- a/libavcodec/mpeg12enc.c +++ b/libavcodec/mpeg12enc.c @@ -203,7 +203,7 @@ static void mpeg1_encode_sequence_header(MpegEncContext *s) if (aspect_ratio == 0.0) aspect_ratio = 1.0; // pixel aspect 1.1 (VGA) - if (s->current_picture.f.key_frame) { + if (s->current_picture.f->key_frame) { AVRational framerate = ff_mpeg12_frame_rate_tab[s->frame_rate_index]; /* mpeg1 header repeated every gop */ @@ -293,10 +293,10 @@ static void mpeg1_encode_sequence_header(MpegEncContext *s) /* time code: we must convert from the real frame rate to a * fake MPEG frame rate in case of low frame rate */ fps = (framerate.num + framerate.den / 2) / framerate.den; - time_code = s->current_picture_ptr->f.coded_picture_number + + time_code = s->current_picture_ptr->f->coded_picture_number + s->avctx->timecode_frame_start; - s->gop_picture_number = s->current_picture_ptr->f.coded_picture_number; + s->gop_picture_number = s->current_picture_ptr->f->coded_picture_number; if (s->drop_frame_timecode) { /* only works for NTSC 29.97 */ int d = time_code / 17982; @@ -412,7 +412,7 @@ void ff_mpeg1_encode_picture_header(MpegEncContext *s, int picture_number) if (s->progressive_sequence) put_bits(&s->pb, 1, 0); /* no repeat */ else - 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); /* XXX: optimize the generation of this flag with entropy measures */ s->frame_pred_frame_dct = s->progressive_sequence; @@ -436,7 +436,7 @@ void ff_mpeg1_encode_picture_header(MpegEncContext *s, int picture_number) for (i = 0; i < sizeof(svcd_scan_offset_placeholder); i++) put_bits(&s->pb, 8, svcd_scan_offset_placeholder[i]); } - side_data = av_frame_get_side_data(&s->current_picture_ptr->f, + side_data = av_frame_get_side_data(s->current_picture_ptr->f, AV_FRAME_DATA_STEREO3D); if (side_data) { AVStereo3D *stereo = (AVStereo3D *)side_data->data; -- cgit v1.2.3