diff options
author | Anton Khirnov <anton@khirnov.net> | 2012-11-21 21:34:46 +0100 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2013-03-08 07:38:30 +0100 |
commit | 759001c534287a96dc96d1e274665feb7059145d (patch) | |
tree | 6ace9560c20aa30db92067c5b45d7bd86e458d10 /libavcodec/libvpxdec.c | |
parent | 6e7b50b4270116ded8b874d76cb7c5b1a0341827 (diff) | |
download | android_external_ffmpeg-759001c534287a96dc96d1e274665feb7059145d.tar.gz android_external_ffmpeg-759001c534287a96dc96d1e274665feb7059145d.tar.bz2 android_external_ffmpeg-759001c534287a96dc96d1e274665feb7059145d.zip |
lavc decoders: work with refcounted frames.
Diffstat (limited to 'libavcodec/libvpxdec.c')
-rw-r--r-- | libavcodec/libvpxdec.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/libavcodec/libvpxdec.c b/libavcodec/libvpxdec.c index 54eee31dcf..237b0f6a53 100644 --- a/libavcodec/libvpxdec.c +++ b/libavcodec/libvpxdec.c @@ -30,6 +30,7 @@ #include "libavutil/common.h" #include "libavutil/imgutils.h" #include "avcodec.h" +#include "internal.h" typedef struct VP8DecoderContext { struct vpx_codec_ctx decoder; @@ -65,6 +66,7 @@ static int vp8_decode(AVCodecContext *avctx, AVFrame *picture = data; const void *iter = NULL; struct vpx_image *img; + int ret; if (vpx_codec_decode(&ctx->decoder, avpkt->data, avpkt->size, NULL, 0) != VPX_CODEC_OK) { @@ -92,14 +94,10 @@ static int vp8_decode(AVCodecContext *avctx, return AVERROR_INVALIDDATA; avcodec_set_dimensions(avctx, img->d_w, img->d_h); } - picture->data[0] = img->planes[0]; - picture->data[1] = img->planes[1]; - picture->data[2] = img->planes[2]; - picture->data[3] = NULL; - picture->linesize[0] = img->stride[0]; - picture->linesize[1] = img->stride[1]; - picture->linesize[2] = img->stride[2]; - picture->linesize[3] = 0; + if ((ret = ff_get_buffer(avctx, picture, 0)) < 0) + return ret; + av_image_copy(picture->data, picture->linesize, img->planes, + img->stride, avctx->pix_fmt, img->d_w, img->d_h); *got_frame = 1; } return avpkt->size; @@ -126,7 +124,7 @@ AVCodec ff_libvpx_vp8_decoder = { .init = vp8_init, .close = vp8_free, .decode = vp8_decode, - .capabilities = CODEC_CAP_AUTO_THREADS, + .capabilities = CODEC_CAP_AUTO_THREADS | CODEC_CAP_DR1, .long_name = NULL_IF_CONFIG_SMALL("libvpx VP8"), }; #endif /* CONFIG_LIBVPX_VP8_DECODER */ |