aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/nuv.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2012-11-21 21:34:46 +0100
committerAnton Khirnov <anton@khirnov.net>2013-03-08 07:38:30 +0100
commit759001c534287a96dc96d1e274665feb7059145d (patch)
tree6ace9560c20aa30db92067c5b45d7bd86e458d10 /libavcodec/nuv.c
parent6e7b50b4270116ded8b874d76cb7c5b1a0341827 (diff)
downloadffmpeg-759001c534287a96dc96d1e274665feb7059145d.tar.gz
lavc decoders: work with refcounted frames.
Diffstat (limited to 'libavcodec/nuv.c')
-rw-r--r--libavcodec/nuv.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/libavcodec/nuv.c b/libavcodec/nuv.c
index 193bed6e71..4d5063fad7 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;
}