diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2014-02-24 13:15:16 +0400 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-02-24 13:15:19 +0400 |
commit | 7a9946d386a3736abde0d7584bef526dc779a36f (patch) | |
tree | 0c95382aac1138e1f635f983f2d385882b734168 /libavcodec/utils.c | |
parent | 74bb1ca82c3bf604e460f581d9ac9dbe2af19448 (diff) | |
parent | 8feac29cc46270cc89d6016340e7bac780877131 (diff) |
Merge commit '8feac29cc46270cc89d6016340e7bac780877131'
* commit '8feac29cc46270cc89d6016340e7bac780877131':
lavc: use AVFrame API properly in ff_reget_buffer()
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/utils.c')
-rw-r--r-- | libavcodec/utils.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/libavcodec/utils.c b/libavcodec/utils.c index d24854a987..40567f51d3 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -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; } |