mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-24 13:56:33 +02:00
lavc: use AVFrame API properly in ff_reget_buffer()
This commit is contained in:
parent
1155fd02ae
commit
8feac29cc4
@ -754,7 +754,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
|
||||
|
||||
int ff_reget_buffer(AVCodecContext *avctx, AVFrame *frame)
|
||||
{
|
||||
AVFrame tmp;
|
||||
AVFrame *tmp;
|
||||
int ret;
|
||||
|
||||
av_assert0(avctx->codec_type == AVMEDIA_TYPE_VIDEO);
|
||||
@ -768,18 +768,20 @@ int ff_reget_buffer(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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user