X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Fnuv.c;h=4d5063fad7ff9843d7d21bca8787949f98ad3dd2;hb=f099d3d1d5466bd63f4ab36270d169ff9ea613b8;hp=193bed6e71bc004561e7f454e08c1e995fd0a4fd;hpb=c242bbd8b6939507a1a6fb64101b0553d92d303f;p=ffmpeg diff --git a/libavcodec/nuv.c b/libavcodec/nuv.c index 193bed6e71b..4d5063fad7f 100644 --- a/libavcodec/nuv.c +++ b/libavcodec/nuv.c @@ -27,6 +27,7 @@ #include "libavutil/lzo.h" #include "libavutil/imgutils.h" #include "avcodec.h" +#include "internal.h" #include "rtjpeg.h" typedef struct { @@ -220,14 +221,12 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, buf_size -= RTJPEG_HEADER_SIZE; } - if (keyframe && c->pic.data[0]) { - avctx->release_buffer(avctx, &c->pic); + if (keyframe) { + av_frame_unref(&c->pic); init_frame = 1; } - c->pic.reference = 3; - c->pic.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_READABLE | - FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE; - result = avctx->reget_buffer(avctx, &c->pic); + + result = ff_reget_buffer(avctx, &c->pic); if (result < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return result; @@ -269,7 +268,9 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, return AVERROR_INVALIDDATA; } - *picture = c->pic; + if ((result = av_frame_ref(picture, &c->pic)) < 0) + return result; + *got_frame = 1; return orig_size; } @@ -304,8 +305,7 @@ static av_cold int decode_end(AVCodecContext *avctx) NuvContext *c = avctx->priv_data; av_freep(&c->decomp_buf); - if (c->pic.data[0]) - avctx->release_buffer(avctx, &c->pic); + av_frame_unref(&c->pic); return 0; }