summaryrefslogtreecommitdiff
path: root/libavcodec/motionpixels.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/motionpixels.c
parent6e7b50b4270116ded8b874d76cb7c5b1a0341827 (diff)
downloadffmpeg-759001c534287a96dc96d1e274665feb7059145d.tar.gz
lavc decoders: work with refcounted frames.
Diffstat (limited to 'libavcodec/motionpixels.c')
-rw-r--r--libavcodec/motionpixels.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/libavcodec/motionpixels.c b/libavcodec/motionpixels.c
index c2bd0f4d2b..c205735c90 100644
--- a/libavcodec/motionpixels.c
+++ b/libavcodec/motionpixels.c
@@ -22,6 +22,7 @@
#include "avcodec.h"
#include "get_bits.h"
#include "dsputil.h"
+#include "internal.h"
#define MAX_HUFF_CODES 16
@@ -244,13 +245,11 @@ static int mp_decode_frame(AVCodecContext *avctx,
int buf_size = avpkt->size;
MotionPixelsContext *mp = avctx->priv_data;
GetBitContext gb;
- int i, count1, count2, sz;
+ int i, count1, count2, sz, ret;
- mp->frame.reference = 1;
- mp->frame.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE;
- if (avctx->reget_buffer(avctx, &mp->frame)) {
+ if ((ret = ff_reget_buffer(avctx, &mp->frame)) < 0) {
av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n");
- return -1;
+ return ret;
}
/* le32 bitstream msb first */
@@ -295,8 +294,9 @@ static int mp_decode_frame(AVCodecContext *avctx,
ff_free_vlc(&mp->vlc);
end:
+ if ((ret = av_frame_ref(data, &mp->frame)) < 0)
+ return ret;
*got_frame = 1;
- *(AVFrame *)data = mp->frame;
return buf_size;
}
@@ -308,8 +308,7 @@ static av_cold int mp_decode_end(AVCodecContext *avctx)
av_freep(&mp->vpt);
av_freep(&mp->hpt);
av_freep(&mp->bswapbuf);
- if (mp->frame.data[0])
- avctx->release_buffer(avctx, &mp->frame);
+ av_frame_unref(&mp->frame);
return 0;
}