Commit 7a9946d3 authored by Michael Niedermayer's avatar Michael Niedermayer

Merge commit '8feac29c'

* commit '8feac29c':
  lavc: use AVFrame API properly in ff_reget_buffer()
Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents 74bb1ca8 8feac29c
...@@ -989,7 +989,7 @@ int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags) ...@@ -989,7 +989,7 @@ int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
static int reget_buffer_internal(AVCodecContext *avctx, AVFrame *frame) static int reget_buffer_internal(AVCodecContext *avctx, AVFrame *frame)
{ {
AVFrame tmp; AVFrame *tmp;
int ret; int ret;
av_assert0(avctx->codec_type == AVMEDIA_TYPE_VIDEO); av_assert0(avctx->codec_type == AVMEDIA_TYPE_VIDEO);
...@@ -1011,18 +1011,20 @@ static int reget_buffer_internal(AVCodecContext *avctx, AVFrame *frame) ...@@ -1011,18 +1011,20 @@ static int reget_buffer_internal(AVCodecContext *avctx, AVFrame *frame)
return 0; 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); ret = ff_get_buffer(avctx, frame, AV_GET_BUFFER_FLAG_REF);
if (ret < 0) { if (ret < 0) {
av_frame_unref(&tmp); av_frame_free(&tmp);
return ret; return ret;
} }
av_image_copy(frame->data, frame->linesize, tmp.data, tmp.linesize, av_frame_copy(frame, tmp);
frame->format, frame->width, frame->height); av_frame_free(&tmp);
av_frame_unref(&tmp);
return 0; return 0;
} }
......
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