Merge commit '8feac29cc46270cc89d6016340e7bac780877131'

* commit '8feac29cc46270cc89d6016340e7bac780877131':
  lavc: use AVFrame API properly in ff_reget_buffer()

Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2014-02-24 10:15:16 +01:00
commit 7a9946d386
1 changed files with 9 additions and 7 deletions

View File

@ -989,7 +989,7 @@ int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
static int reget_buffer_internal(AVCodecContext *avctx, AVFrame *frame)
{
AVFrame tmp;
AVFrame *tmp;
int ret;
av_assert0(avctx->codec_type == AVMEDIA_TYPE_VIDEO);
@ -1011,18 +1011,20 @@ static int reget_buffer_internal(AVCodecContext *avctx, AVFrame *frame)
return 0;
}
av_frame_move_ref(&tmp, frame);
tmp = av_frame_alloc();
if (!tmp)
return AVERROR(ENOMEM);
av_frame_move_ref(tmp, frame);
ret = ff_get_buffer(avctx, frame, AV_GET_BUFFER_FLAG_REF);
if (ret < 0) {
av_frame_unref(&tmp);
av_frame_free(&tmp);
return ret;
}
av_image_copy(frame->data, frame->linesize, tmp.data, tmp.linesize,
frame->format, frame->width, frame->height);
av_frame_unref(&tmp);
av_frame_copy(frame, tmp);
av_frame_free(&tmp);
return 0;
}